I have done this and the page does not appear to complete.
Depending on how you've got this coded (which we can only speculate about, since you haven't shown us code), you may be suffering from the HTTP/1.1 "Connection" optimization. If the HTTP header of request you're sending includes
Connection: keep-alive
then the site you're fetching the template from has kept the socket open, and is quietly waiting for your next request. If your script is doing something like
while ( $chunk = <$socket> ) {
print $chunk;
}
then you'll hang until the web server times out and closes the socket.
If this is the problem, sending
Connection: close
with the request tells the web server to close the connection after serving you the template.
Alternatively, you can honor the Content-length: response header, read exactly that many bytes of response, then close the socket yourself.
| [reply] [d/l] [select] |
Usually the problem is the Content-Length field. I had the same kind of thing before. Most of the client side program determines whether it has received the whole page, base on the value received in Content-Length field.
Better to fix the Content-Length field when you modify the content of a page.
But, some time you don't need to fix the length, it still appears to be okay, why? That is because, the client reads in msg from socket chunk by chunk, not bytes by bytes, so there is a grey area. Look at the folllowing two examples:
- (Here is a negative case) The Content-Length = 1001, when the real content is only 1000 bytes long. Say, after received the last chunk of msg, the client received 1000 bytes, so it expects one more chunk containing the last byte, but the server has already transferred the whole content and stopped. The client will never receive any more bytes, and it just waits and waits until timeout.
- (Here is a positive case, the grey area worked) The Content-Length = 999, when the real content is 1200 bytes long. Now after received the last chunk of msg, the client received 998 bytes, so it waits for the next chunk, the server trasfers the next chunk, which is 202 bytes long, and stops. The client has now received 1200 bytes, which is greater than 999, so it is also satisfied.
| [reply] |
| [reply] |
Pure guess (since you didn't send us any code :-)
Did you shorten the length of the HTML, and forget to adjust the Content-Length header?
| [reply] |