Opened 17 years ago

Last modified 13 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:


Change History (2)

comment:1 Changed 17 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).


comment:2 Changed 13 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.