1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

fix: when reading response, only readline() if previous read()

was non-empty
This commit is contained in:
Ilya Kreymer 2014-04-09 16:44:45 -07:00
parent bfc2e63793
commit 7636c9d3f7

View File

@ -204,13 +204,17 @@ class RewriteContent:
if first_buff: if first_buff:
buff = first_buff buff = first_buff
else: else:
buff = stream.read() + stream.readline() buff = stream.read()
if buff:
buff += stream.readline()
while buff: while buff:
if rewrite_func: if rewrite_func:
buff = rewrite_func(buff) buff = rewrite_func(buff)
yield buff yield buff
buff = stream.read() + stream.readline() buff = stream.read()
if buff:
buff += stream.readline()
# For adding a tail/handling final buffer # For adding a tail/handling final buffer
if final_read_func: if final_read_func: