mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
handle incomplete read
see Vangelis's writeup at https://github.com/internetarchive/warcprox/pull/123
This commit is contained in:
parent
5ced2588d4
commit
0d268659ab
@ -487,9 +487,14 @@ class MitmProxyHandler(http_server.BaseHTTPRequestHandler):
|
||||
tmp_file_max_memory_size=self._tmp_file_max_memory_size)
|
||||
prox_rec_res.begin(extra_response_headers=extra_response_headers)
|
||||
|
||||
buf = prox_rec_res.read(65536)
|
||||
buf = None
|
||||
while buf != b'':
|
||||
buf = prox_rec_res.read(65536)
|
||||
try:
|
||||
buf = prox_rec_res.read(65536)
|
||||
except http_client.IncompleteRead as e:
|
||||
self.logger.warn('%s from %s', e, self.url)
|
||||
buf = b''
|
||||
|
||||
if (self._max_resource_size and
|
||||
prox_rec_res.recorder.len > self._max_resource_size):
|
||||
prox_rec_res.truncated = b'length'
|
||||
|
Loading…
x
Reference in New Issue
Block a user