[Tutor] Python socket programming

Jeroen Vogelpoel n.a.vogelpoel at chello.nl
Sun Apr 25 22:20:55 EDT 2004

Lloyd Kvam wrote:

> This may not be relevant, but you are not actually passing an HTTP/1.1
> request, since there are no headers.  I would try a simple:
> 	GET /
> which is HTTP .9 and see if that gets a response from the webserver.
> In other words, you may really be debugging a webserver failure rather
> than a socket program error.  (Yes an invalid HTTP/1.1 request should
> provoke an invalid request response, but your request may to too invalid
> for the server.)
> Alternatively, if ONLY local connections work, that raises the
> possibility of some kind of network issue.  Could your internal network
> enforce the use of a web proxy server for all outside access?  Were the
> working socket programs in other languages executing the same test to
> the same webserver?

Hmm, got a few interesting points there. I've just tried to connect to 
my webserver using plain old telnet and I got responses on both "GET 
/\n" and "GET / HTTP/1.1\n\n", so I assume the error handling on my 
webserver works fine and looking at the reports in the logs, so does the 
logging mechanism. Thus as far as that is concerned, the webserver 
itself is operating normally. The misformed HTTP/1.1 request, well... I 
don't have an excuse for that other then sloppy coding while trying to 
make this sockets idea work.

Actually, I've just found out what is is... A bit more experimenting 
with poking around on port 80 on my local server revealed the rather 
embarrasing cause: A simple missing newline. It should have been "GET 
/\n" instead of just "GET /". Sloppy coding indeed. Sorry to have wasted 
everyone's time, I'll go smash my head against the wall a few times.

Thank you for trying to help though! :)

More information about the Tutor mailing list