Opened 14 years ago

Last modified 11 years ago

#1010 enhancement new

Be more failure tolerant in HTTPClient.lineReceived?

Reported by: jojo Owned by: jknight
Priority: normal Milestone:
Component: web Keywords: httpclient
Cc: Jean-Paul Calderone, jknight, jojo Branch:
Author:

Description


Change History (2)

comment:1 Changed 14 years ago by jojo

In method lineReceived() from web.http.HTTPClient there is no check when
splitting header lines (line 384 in the svn-version):

[...]
if line:
    key, val = line.split(':', 1)
    val = val.lstrip()
    self.handleHeader(key, val)
[...]

Maybe there could be a try-except block checking for ValueError and skipping
malformed lines. Or maybe one should check whether the line contains only
whitespace by strip()ping it beforehand.

I occasionally get responses from web servers with such whitespace header lines
resulting in ValueError exceptions (and tracebacks being printed).

-jojo

comment:2 Changed 11 years ago by Jean-Paul Calderone

Keywords: httpclient added

See the commentary on #2842. This may be the same issue. If not, examples of web servers which behave this way would be nice.

Note: See TracTickets for help on using tickets.