I'm using the built-in web server for development on Windows with
web.py 0.22. I find that when a page references a css file,
the page takes about 10 second to load. But if I remove the css link,
the page loads immediately (w/o style.) I then access the css file
directly like this: http://localhost:8080/static/style.css
and the css file takes about 10 seconds to load.

I tried with an image file in static folder, which loads
immediately. I tried both IE and firefox, same behavior. The server
command line shows an entry for style.css immediately but it
won't be loaded until after about 10 seconds in browser.

I tried retrieving the css with Python urllib, I get the file
immediately every time. So it seems that the problem is in the
browser - it seems that the browser doesn't think it's got the whole
file.

I went ahead and studied the headers that got sent between IE and
CherryPy. I notice that CherryPy is doing three things wrong here:
1. It replies HTTP/1.0 with Keep-Alive with HTTP/1.1 reply
2. It sends "Connection: Keep-Alive" which is not necessary
   because HTTP/1.1 defaults to keep-alive.
3. It eats 0xd from 0xd 0xa in the original file, and only sends 0xa,
   but the Content-Length it reports includes 0xd so the browser was
   expecting more data. Contnet-Length says 1178 bytes but it actually
   sends 1100 bytes.

Problem 1 and 2 are not too bad. Problem 3 is bad and seems to be
what's causing the problem. So the css file won't be displayed until
CherryPy times out the connection and sends a FIN packet.

Hopefully someone who's familiar with the code can double-check and
come up with a fix :)

(Request Method)        GET /static/style.css HTTP/1.0
Accept                  image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
application/x-shockwave-flash, application/vnd.ms-excel, 
application/vnd.ms-powerpoint, application/msword, */*
Accept-Language         en-us
User-Agent              Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
.NET CLR 2.0.50727)
Host                    localhost:8080
Connection              Keep-Alive

(Response Status)       HTTP/1.1 200
Content-type            text/css
Content-Length          1178
Last-Modified           Tue, 25 Dec 2007 22:50:41 GMT
Connection              Keep-Alive
Date                    Wed, 26 Dec 2007 02:59:26 GMT
Server                  CherryPy/3.0.1



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to