CGIHTTPServer and POST with Netscape versus IE

Peter Hansen peter at engcorp.com
Mon Jan 6 22:32:29 EST 2003


(This may be my first question in this newsgroup.  Please
be gentle! :-)

We've encountered a little problem in a test program
involving the standard module CGIHTTPServer.py and a POST
operation from Internet Explorer.

In summary, Netscape always works, but when using
Internet Explorer 6.0 (SP1, probably all versions fail)
a POST operation will result in a message (not a 404 or 
any other recognizable HTTP error) that reads:

   "The page cannot be displayed" 

along with a page full of friendly advice about what I
might have done wrong, and a title bar reading "Cannot
find server".

After extensive investigation, we discovered that IE is
appending a CR LF pair to the request body, but is not
reporting it in the Content-length field.  (The actual
data is 23 bytes long, or 25 with these two.)  By 
modifying the CGIHTTPServer.py code to read two extra
bytes, we "fix" the problem, but then of course the 
server hangs when accessed from Netscape which doesn't
supply the extra two bytes.

My questions: 

Is this a known problem for IE and maybe other browsers?

Is it legal for a browser to do this, in which case is 
it something CGIHTTPServer.py should be handling?

Can anyone point me to other code (haven't been able to
find the relevant lines in Zope yet) in web servers which
might already handle this in a general and safe manner?

Thanks for any pointers.  I've tried a few Google searches
so far without any bites, but it seems pretty obvious that
this is something that is known and solved, if I knew
where to look, and it seems likely the fix should be added
to CGIHTTPServer.py.

-Peter




More information about the Python-list mailing list