Simple HTTP client bug?

Fredrik Lundh fredrik at effbot.org
Thu Dec 7 15:25:49 EST 2000


David Lees wrote:
> I am trying to run the following simple HTTP client code, copied
> directly from "Programming in Python with Medusa and the Async Sockets
> Library"

just curious, but what's Programming in Python with Medusa
and the Async Sockets Library"?

as for your question, the answer is found in the debugging
print-out:

> starting asyncore loop
> sending GET
> GET  HTTP/1.0

"GET  HTTP/1.0" is definitely not a valid HTTP command.
you're supposed to put an URL between the GET and the
HTTP/1.0.

either make sure you explicitly specify a path name (not
just a host name), or add a test to the URL parsing code:

    host = parts[1]
    path = parts[2]
    if not path:
        path = "/" # don't call with an empty path
    print 'host,path=',host,path

</F>





More information about the Python-list mailing list