mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
minor bug fix header replace
This commit is contained in:
parent
d2cfa5ca41
commit
dd2e0d1df3
@ -172,6 +172,7 @@ class Headers(multidict.MultiDict):
|
||||
repl = strutils.escaped_str_to_bytes(repl)
|
||||
pattern = re.compile(pattern, flags)
|
||||
replacements = 0
|
||||
flag_count = count > 0
|
||||
|
||||
fields = []
|
||||
for name, value in self.fields:
|
||||
@ -183,10 +184,13 @@ class Headers(multidict.MultiDict):
|
||||
# There's not much we can do about this, so we just keep the header as-is.
|
||||
pass
|
||||
else:
|
||||
count -= n
|
||||
replacements += n
|
||||
if count == 0:
|
||||
break;
|
||||
|
||||
if flag_count:
|
||||
count -= n
|
||||
if count == 0:
|
||||
break;
|
||||
|
||||
fields.append((name, value))
|
||||
self.fields = tuple(fields)
|
||||
return replacements
|
||||
|
Loading…
Reference in New Issue
Block a user