mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
fix #3833
This commit is contained in:
parent
6d3b8c9716
commit
3c1ced2b17
@ -162,8 +162,12 @@ class Headers(multidict.MultiDict):
|
|||||||
pattern = re.compile(pattern, flags)
|
pattern = re.compile(pattern, flags)
|
||||||
replacements = 0
|
replacements = 0
|
||||||
flag_count = count > 0
|
flag_count = count > 0
|
||||||
|
count_reached = False
|
||||||
fields = []
|
fields = []
|
||||||
for name, value in self.fields:
|
for name, value in self.fields:
|
||||||
|
if count_reached:
|
||||||
|
fields.append((name, value))
|
||||||
|
continue
|
||||||
line, n = pattern.subn(repl, name + b": " + value, count=count)
|
line, n = pattern.subn(repl, name + b": " + value, count=count)
|
||||||
try:
|
try:
|
||||||
name, value = line.split(b": ", 1)
|
name, value = line.split(b": ", 1)
|
||||||
@ -173,10 +177,12 @@ class Headers(multidict.MultiDict):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
replacements += n
|
replacements += n
|
||||||
|
fields.append((name, value))
|
||||||
if flag_count:
|
if flag_count:
|
||||||
count -= n
|
count -= n
|
||||||
if count == 0:
|
if count == 0:
|
||||||
break
|
count_reached = True
|
||||||
|
continue
|
||||||
fields.append((name, value))
|
fields.append((name, value))
|
||||||
self.fields = tuple(fields)
|
self.fields = tuple(fields)
|
||||||
return replacements
|
return replacements
|
||||||
|
Loading…
Reference in New Issue
Block a user