mnot/thor — pull request #21 by izuzak (2011-12-18 21:47:16+00:00)
Title: Keep http client alive if the server prematurely closes the connection after sending all the headers and inspecting mode is turned on

Hey Mark,

I haven't given up on that duplicate CL issue for redbot :) Anyway, this change enables the thor http client to continue processing when multiple CL headers are present, and the final CL has a value that is higher than the actual body length. In this case, when the server closes the connection - the client currently raises an input_error in _conn_closed since it expected more bytes. However, if inspecting mode is turned on - the client should try make the best of the situation and continue processing as if the complete body was received (so that redbot can report the error). As far as I can see, there is no (nice) way to handle this in redbot alone, so I'm hacking into thor also.