mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
Rename _read_token to _read_key
Since we also have a _read_value
This commit is contained in:
parent
29046e6b48
commit
90a48ccc06
@ -57,13 +57,6 @@ def _read_until(s, start, term):
|
|||||||
return s[start:i + 1], i + 1
|
return s[start:i + 1], i + 1
|
||||||
|
|
||||||
|
|
||||||
def _read_token(s, start):
|
|
||||||
"""
|
|
||||||
Read a token - the LHS of a token/value pair in a cookie.
|
|
||||||
"""
|
|
||||||
return _read_until(s, start, ",;=")
|
|
||||||
|
|
||||||
|
|
||||||
def _read_quoted_string(s, start):
|
def _read_quoted_string(s, start):
|
||||||
"""
|
"""
|
||||||
start: offset to the first quote of the string to be read
|
start: offset to the first quote of the string to be read
|
||||||
@ -91,6 +84,13 @@ def _read_quoted_string(s, start):
|
|||||||
return "".join(ret), i + 1
|
return "".join(ret), i + 1
|
||||||
|
|
||||||
|
|
||||||
|
def _read_key(s, start, delims=";="):
|
||||||
|
"""
|
||||||
|
Read a key - the LHS of a token/value pair in a cookie.
|
||||||
|
"""
|
||||||
|
return _read_until(s, start, delims)
|
||||||
|
|
||||||
|
|
||||||
def _read_value(s, start, delims):
|
def _read_value(s, start, delims):
|
||||||
"""
|
"""
|
||||||
Reads a value - the RHS of a token/value pair in a cookie.
|
Reads a value - the RHS of a token/value pair in a cookie.
|
||||||
@ -113,7 +113,7 @@ def _read_pairs(s, off=0):
|
|||||||
pairs = []
|
pairs = []
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
lhs, off = _read_token(s, off)
|
lhs, off = _read_key(s, off, ";=,")
|
||||||
lhs = lhs.lstrip()
|
lhs = lhs.lstrip()
|
||||||
|
|
||||||
if lhs:
|
if lhs:
|
||||||
|
Loading…
Reference in New Issue
Block a user