Something funny with HEAD ?

Simon Lyall simon at darkmere.gen.nz
Wed Feb 23 23:06:11 CET 2011


I was testing out using a HEAD request to pre-load my cache with newly 
created content (which it does, good) and I noticed a weird timeout.

When I use curl it takes a few seconds before timing out. This is even 
the case when the body is only a few bytes.


# time curl -v -X HEAD http://www.varnish-cache.org

* About to connect() to www.varnish-cache.org port 80
*   Trying 87.238.37.6... connected
* Connected to www.varnish-cache.org (87.238.37.6) port 80
> HEAD / HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: www.varnish-cache.org
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Apache/2.2.14 (Ubuntu)
< X-Powered-By: PHP/5.3.2-1ubuntu4.7
< Cache-Control: public, max-age=43200
< Last-Modified: Wed, 23 Feb 2011 11:20:32 +0000
< Expires: Sun, 11 Mar 1984 12:00:00 GMT
< Vary: Cookie,Accept-Encoding
< ETag: "1298460032"
< Content-Type: text/html; charset=utf-8
< Content-Length: 23470
< Date: Wed, 23 Feb 2011 21:58:26 GMT
< X-Varnish: 864838647 864663774
< Age: 38274
< Via: 1.1 varnish
< Connection: keep-alive
* transfer closed with 23470 bytes remaining to read
* Closing connection #0
curl: (18) transfer closed with 23470 bytes remaining to read

real    0m5.833s
user    0m0.002s
sys     0m0.002s


Compare this to a normal GET


# time curl -v http://www.varnish-cache.org > /dev/null
* About to connect() to www.varnish-cache.org port 80
*   Trying 87.238.37.6... connected
* Connected to www.varnish-cache.org (87.238.37.6) port 80
> GET / HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: www.varnish-cache.org
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Apache/2.2.14 (Ubuntu)
< X-Powered-By: PHP/5.3.2-1ubuntu4.7
< Cache-Control: public, max-age=43200
< Last-Modified: Wed, 23 Feb 2011 11:20:32 +0000
< Expires: Sun, 11 Mar 1984 12:00:00 GMT
< Vary: Cookie,Accept-Encoding
< ETag: "1298460032"
< Content-Type: text/html; charset=utf-8
< Content-Length: 23470
< Date: Wed, 23 Feb 2011 22:00:22 GMT
< X-Varnish: 864838987 864663774
< Age: 38390
< Via: 1.1 varnish
< Connection: keep-alive
   % Total    % Received % Xferd  Average Speed   Time    Time     Time 
Current
                                  Dload  Upload   Total   Spent    Left 
Speed
100 23470  100 23470    0     0  39348      0 --:--:-- --:--:-- --:--:-- 
72243* Connection #0 to host www.varnish-cache.org left intact

* Closing connection #0

real    0m0.602s
user    0m0.001s
sys     0m0.004s





-- 
Simon Lyall  |  Very Busy  |  Web: http://www.darkmere.gen.nz/
"To stay awake all night adds a day to your life" - Stilgar | eMT.





More information about the varnish-misc mailing list