Test web server

Alan Kennedy alanmk at hotmail.com
Fri Aug 15 12:23:15 EDT 2003


Alan Kennedy wrote:
>> What version of Mozilla are you using?

Axel Grune wrote:
> Mozilla 1.4 (Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.4)
> Gecko/20030612)

Sorry, I don't have access to that right now. Perhaps someone else can
try it out?

One thing I did notice about your code is that the Content-length is
not being set precisely.

When you use a multi-line string, and put a line break at the end of
the last line, that line break is stored in the string as a character,
which increases the size of data you are sending.

So although your HTML is 71 bytes long, with the implicit '\n' it's 72
bytes long. Perhaps this is making a difference to Mozilla?

Try using this code to set the data you are sending:

CONTENT = "<html><head><title>test</title></head><body>Hello
Python!</body></html>"

DATA = """HTTP/1.0 200 OK
Connection: Keep-Alive
Content-Type: text/html
Content-length: %d
Server: Python

%s""" % (len(CONTENT), CONTENT)

And see if that makes a difference?

regards,

-- 
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan:              http://xhaus.com/mailto/alan




More information about the Python-list mailing list