Select weirdness
Bjoern Schliessmann
usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Sun Apr 22 06:34:31 EDT 2007
Ron Garret wrote:
> print>>self.wfile, 'HTTP/1.0 200 OK'
> print>>self.wfile, 'Content-type: text/plain'
> print>>self.wfile
> print>>self.wfile, 'foo'
> [...]
> If I telnet into this server and type in an HTTP request manually
> it works fine. But when I try to access this with a browser (I've
> tried Firefox and Safari -- both do the same thing) it hangs
> immediately after reading the first line in the request (i.e.
> before reading the first header).
Could the problem be that print ends lines with "\r\n" not on all
platforms? Try doing it explicitly.
> The only difference I can discern is that the browser send \r\n
> for end-of-line while telnet just sends \n.
Then, I think, your telnet client is broken. I've seem multiple
applications relying on telnet or similar protocols which
required "\r\n" as end-of-line. E. g. I needed to hack
twisted.protocols.basic.LineReceiverFactory since it showed the
exact behaviour you described for browsers. It showed up because
busybox' telnet only sends \n as EOL.
> But I don't see why that should make any difference.
Easy. If you only accept "\r\n" as EOL, you'll wait forever unless
you really receive it.
Regards,
Björn
--
BOFH excuse #81:
Please excuse me, I have to circuit an AC line through my head to
get this database working.
More information about the Python-list
mailing list