Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Socket reads messed up?? readline long lines (HTTPServer)

3 views
Skip to first unread message

Andy Eskilsson

unread,
Jan 27, 1998, 3:00:00 AM1/27/98
to

I am experimenting with the HTTPServer coming in the dist. And well I
am running the server on a Windows NT machine with python 1.5 found at
www.python.org.

The problem is that the line seems to be cut, truncated..

Well to make it happen again, start the SimpleHTTPServer, and issue:

telnet machine 8000 and type the following:

GET /test.html HTTP/1.0
Accept: x-sun-attachment, text/richtext, text/enriched, sun-deskset-message, message/partial, message/external-body, message/external-body, mail-file, image/x-xpixmap, image/x-xbitmap, image/x-rgb, image/x-portable-pixmap, image/x-portable-graymap, image/x-portable-bitmap, image/tiff, image/targa, image/postscript, image/pm, image/jpeg, image/gif, image/fits, image/cmu-raster, image/bmp, default, audio/basic, application/x-debian-package, application/applefile, application/applefile, text/html, text/plain, text/sgml, text/x-sgml, application/x-wais-source, application/html, application/x-ksh, application/x-sh, application/x-csh, video/mpeg, image/jpeg, image/x-tiff, image/x-rgb, image/x-png, image/x-xbitmap, image/x-xbm, image/gif, application/postscript, */*;q=0.001
HTTP/1.0 404 File not found #this is what the server answers
Server: SimpleHTTP/0.3 Python/1.5 # !!!!!!!!!!!!
[...]

Well what happens is that the page comes without me ending the headers
with an empty line! Looking closer in, it seems as though the readline
following the GET[..] only returns '0.001', I have tried reading it
byte by byte, and it still only receives 0.001..

When only sending something like:
Accept: x-sun-attachment, text/richtext, text/enriched, sun-deskset-message, message/partial, message/external-body, message/external-body, mail-file, image/x-xpixmap, image/x-xbitmap, image/x-rgb, image/x-portable-pixmap, image/x-portable-graymap, image/x-portable-bitmap

It works, but not on:
Accept: x-sun-attachment, text/richtext, text/enriched, sun-deskset-message, message/partial, message/external-body, message/external-body, mail-file, image/x-xpixmap, image/x-xbitmap, image/x-rgb, image/x-portable-pixmap, image/x-portable-graymap, image/x-portable-bitmap, image/tiff, image/targa, image/postscript, image/pm, image/jpeg, image/gif

What have I missed, I get these problems when the server runs on both
NT and UNIX.

/andy

Guido van Rossum

unread,
Jan 27, 1998, 3:00:00 AM1/27/98
to

> I am experimenting with the HTTPServer coming in the dist. And well I
> am running the server on a Windows NT machine with python 1.5 found at
> www.python.org.
>
> The problem is that the line seems to be cut, truncated..
>
> Well to make it happen again, start the SimpleHTTPServer, and issue:
>
> telnet machine 8000 and type the following:

What you are seeing is caused by line folding in telnet, not by the
server. I get the same problem using telnet, but not when I open a
socket from Python and write the same data to it.

--Guido van Rossum (home page: http://www.python.org/~guido/)


0 new messages