- From: Nick Kew <nick@webthing.com>
- Date: Sat, 25 Jan 2003 17:48:07 +0000 (GMT)
- To: Ville Skyttä <ville.skytta@iki.fi>
- cc: "Nigel J. Andrews" <nandrews@investsystems.co.uk>, www-validator@w3.org
On 25 Jan 2003, Ville Skyttä wrote: > > On Fri, 2003-01-24 at 01:07, Nigel J. Andrews wrote: > > > My little application is in perl. It sends the http request to the validator > > and then reads the response using the standard perl construct of > > while (<fh>) ... The first returned line was processed after 2 seconds but the > > loop only finished 16 seconds after that. Adding the header Connection: close > > to the request caused the loop to terminate after only 2-3 seconds. > > Your app is most likely requesting Keep-Alive. Keep-Alive is default behaviour with HTTP/1.1, but not with HTTP/1.0. What does your Client label its request as? > The validator.w3.org > setup supports it, but the problem is that it doesn't send a > Content-Length header. So, your client doesn't know where the response > ends, and must wait until the connection terminates; that's when the > while loop ends. And this is determined by the Keep-Alive timeout, > which happens to be 15 seconds on validator.w3.org. All this is Apache's default behaviour. > See [1] for sample > headers. Common browsers must have some black magic installed to > determine the end of a response, since they don't exhibit the 15 sec > delay. They support Chunked encoding properly. This delay is one reason you shouldn't send a request claiming to be HTTP/1.1 unless your client really groks it. > Yes, validator should send the Content-Length header. However, With HTTP/1.0 that would have some merit. With 1.1 it's irrelevant. > [1] Here's a sample how v.w.o responded to my browser a few minutes ago: > > HTTP/1.1 200 OK > Date: Sat, 25 Jan 2003 11:40:24 GMT > Server: Apache/1.3.27 (Unix) > Content-Language: en > Keep-Alive: timeout=15, max=100 > Connection: Keep-Alive > Transfer-Encoding: chunked > Content-Type: text/html; charset=utf-8 > [...] That is chunked encoding, which means the response is sent in chunks (size determined by Apache's output buffering). Each chunk is labelled so that HTTP/1.1 clients know when the response is complete. This is a good second-best when it is impractical to set content-length - e.g. because (as with validator) it would be expensive to wait for all the content to be generated before starting to send it. -- Nick Kew
Received on Saturday, 25 January 2003 12:48:13 UTC