- From: Ville Skyttä <ville.skytta@iki.fi>
- Date: 25 Jan 2003 14:00:17 +0200
- To: "Nigel J. Andrews" <nandrews@investsystems.co.uk>
- Cc: www-validator@w3.org
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. 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. 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. Using "Connection: close" effectively disables Keep-Alive, which is probably what you want to do. OTOH, if you're using LWP::UserAgent, use "keep_alive => 0" when constructing it, that'll take care of not requesting Keep-Alive in a sane way. Yes, validator should send the Content-Length header. However, implementing that is not practical to the current production version; it prints its responses on the fly. The current development version looks better, it first constructs the response and then outputs it, so it has the necessary information available for implementing Content-Length on the responses. I'll add a RFE for this to Bugzilla. [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 [...] HTH, -- \/ille Skyttä ville.skytta at iki.fi
Received on Saturday, 25 January 2003 07:00:05 UTC