httplib continuation packets

Haakon Riiser hakonrk at
Sat Nov 11 21:37:35 CET 2006

After a long debugging session while scripting my webmail,
I believe I have traced the problem to the way httplib sends
POST requests.

I have compared tcpdump listings from Python 2.4.3 and 2.5.0's
httplib (via urllib/urllib2), Perl's LWP::UserAgent 2.033 and
Firefox 2.0.  Only Python sends the request in such a way that
the mailserver closes the connection before I get any data from
the POST request (immediate FIN packet after the POST request).

httplib always sends the urlencoded POST data in a separate packet
from the HTTP headers, and this seems to cause problems with
the web interface in Ipswitch-IMail/8.05 (the software running on
Doteasy's webmail).

Firefox 2.0 has most of the headers in a single packet, but unlike
httplib, it always places a couple of headers in the continuation
packet as well (usually the content-length and content-type

LWP::UserAgent 2.033 doesn't use continuation at all, and sends
everything in a single packet.

Is this a bug in httplib or the web server?  Is there a
workaround, or should I use Perl for this?


More information about the Python-list mailing list