Mercurial > hg
comparison hgweb.cgi @ 39484:98995b689e03
httppeer: use util.readexactly() to abort on incomplete responses
Plain resp.read(n) may not return exactly n bytes when we need, and to detect
such cases before trying to interpret whatever has been read, we can use
util.readexactly(), which raises an Abort when stream ends unexpectedly. In the
first case here, readexactly() prevents a traceback with struct.error, in the
second it avoids looking for invalid compression engines.
In this test case, _wraphttpresponse doesn't catch the problem (presumably
because it doesn't know transfer encoding), and the code continues reading the
response until it gets to compression engine data. Maybe there should be checks
before the execution gets there, but I'm not sure where (httplib?)
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 08 Sep 2018 21:58:51 +0800 |
parents | 4b0fc75f9403 |
children | 47ef023d0165 |
comparison
equal
deleted
inserted
replaced
39483:1fc39367eafd | 39484:98995b689e03 |
---|