mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 23:09:44 +00:00
Add attribution and license for tnetstring.py
This commit is contained in:
parent
a566684e32
commit
45f4768a5c
@ -2,9 +2,9 @@
|
||||
This module provides more sophisticated flow tracking. These match requests
|
||||
with their responses, and provide filtering and interception facilities.
|
||||
"""
|
||||
import json, hashlib, Cookie, cookielib, base64, copy, re
|
||||
import hashlib, Cookie, cookielib, copy, re
|
||||
import time
|
||||
import netstring, filt, script, utils, encoding, proxy
|
||||
import tnetstring, filt, script, utils, encoding, proxy
|
||||
from email.utils import parsedate_tz, formatdate, mktime_tz
|
||||
import controller, version
|
||||
|
||||
@ -1319,7 +1319,7 @@ class FlowWriter:
|
||||
|
||||
def add(self, flow):
|
||||
d = flow._get_state()
|
||||
netstring.dump(d, self.fo)
|
||||
tnetstring.dump(d, self.fo)
|
||||
|
||||
|
||||
class FlowReadError(Exception):
|
||||
@ -1339,7 +1339,7 @@ class FlowReader:
|
||||
off = 0
|
||||
try:
|
||||
while 1:
|
||||
data = netstring.load(self.fo)
|
||||
data = tnetstring.load(self.fo)
|
||||
off = self.fo.tell()
|
||||
yield Flow._from_state(data)
|
||||
except ValueError, v:
|
||||
|
@ -1,5 +1,25 @@
|
||||
# imported from the tnetstring project: https://github.com/rfk/tnetstring
|
||||
#
|
||||
# Copyright (c) 2011 Ryan Kelly
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
"""
|
||||
|
||||
tnetstring: data serialization using typed netstrings
|
||||
======================================================
|
||||
|
||||
@ -376,18 +396,3 @@ def pop(string,encoding=None):
|
||||
d[key] = val
|
||||
return (d,remain)
|
||||
raise ValueError("unknown type tag")
|
||||
|
||||
|
||||
|
||||
# Use the c-extension version if available
|
||||
try:
|
||||
import _tnetstring
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
dumps = _tnetstring.dumps
|
||||
load = _tnetstring.load
|
||||
loads = _tnetstring.loads
|
||||
pop = _tnetstring.pop
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user