[Python-Dev] httplib and bad response chunking (original) (raw)
Gregory P. Smith greg at electricrain.com
Mon Jul 31 06:48:55 CEST 2006
- Previous message: [Python-Dev] httplib and bad response chunking
- Next message: [Python-Dev] More tracker demos online
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Jul 25, 2006 at 10:32:13PM -0400, Greg Ward wrote:
what I discovered in the wild the other day was a response like this: 0005\r\nabcd\n\r\n0004\r\nabc\n\r\n\r\n i.e. the chunk-size for the terminating empty chunk was missing. This cause httplib.py to blow up with ValueError because it tried to call int(line, 16) assuming that 'line' contained a hex number, when in fact it was the empty string. Oops. IMHO the minimal fix is to turn ValueError into HTTPException (or a subclass thereof); httplib should not raise ValueError just because some server sends a bad response. (The server in question was Apache 2.0.52 running PHP 4.3.9 sending a big hairy error page because the database was down.)
IMNSHO httplib should be fixed and this shouldn't be an error at all as its in the wild and will only show up more and more in the future. Plus file a bug with the apache or php project as appropriate for having a non-RFC compliant response. This is part of the good old network programming addage of being lenient in what you accept.
-g
- Previous message: [Python-Dev] httplib and bad response chunking
- Next message: [Python-Dev] More tracker demos online
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]