Bizarre problem with HTTP POST verb and HTTPServer on Win32 regkey at
Sun Sep 10 02:53:25 CEST 2000


Something very weird is happening; I have written a simple subclass of
HTTPRequestHandler which should handle HTTP GET and HTTP POST.  It works
fine for HTTP GET but seems doesn't always respond to a POST on Win32.

If I create a form with method=POST and submit it then IE fails with
"connection reset by peer", curl ( also fails.  It
looks like a problem with whatever the equivalent of SIGPIPE is on Win32:

administrator$ curl -i -d a=b localhost:6543
administrator$ curl -v -i -d a=b localhost:6543
* Connected to John Smart (
> POST / HTTP/1.0
User-Agent: curl/7.2 (win32) libcurl 7.2.1
Host: localhost:80
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> Content-Length: 3
> Content-Type: application/x-www-form-urlencoded
> a=b

The source is simply:

import BaseHTTPServer

class MyHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):

        def do_POST(this):

        def do_GET(this):
                this.send_header("Content-type", "text/html")

svr = BaseHTTPServer.HTTPServer(('', 6543), MyHTTPRequestHandler)

print "listing on port 6543"


Has anyone got any idea what is going on?


Niall Smart

More information about the Python-list mailing list