cURL / Mailing Lists / curl-users / Single Mail

curl-users

strange behaviour with 304 not modified and HTTP/1.1 persistant connections..

From: Cris Bailiff <c.bailiff_at_awayweb.com>
Date: Mon, 30 Apr 2001 23:39:48 +1000

I'm having a weird problem with libcurl and fetching content with
'If-Modified-Since' when the server supports http/1.1 (and therefore keepalives).

When libcurl connects, and makes a request, it gets the 304 status code and the
headers correctly, but doesn't return from the request until the server at the
other end times out and closes the connection. There is no 'content-length' in
the 304 response, but the servers I've tried don't return any body using
'transfer-encoding: chunked' either, so libcurl seems to just sit and wait for a
body that isn't coming until the server closes the connection.

I'm not sure if its in the RFC's that 304 never has a body, and therefore there's
an implicit 'content-length: 0' curl should apply?

Its trivially reproducible through the command line interface:

---------

bash$ curl -z 'Wed, 18 Apr 2001 06:57:12 GMT' -v -i
http://www.awayweb.com/images/bg-top.jpg
* Connected to webser.awayweb.com (203.16.200.27)
> GET /images/bg-top.jpg HTTP/1.1
User-Agent: curl/7.7.2 (i386-redhat-linux-gnu) libcurl 7.7.2 (SSL 0.9.5)
Host: www.awayweb.com
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
If-Modified-Since: Wed, 18 Apr 2001 06:57:12 GMT
 
HTTP/1.1 304 Not Modified
Date: Tue, 01 May 2001 01:27:42 GMT
Server: Apache/1.3.12 (Red Hat/Linux)
ETag: "13324-3259-3adbe948"
                                   
---------
At this point, curl just hangs, until the server closes. I would have thought it
should return immediately, once the 304 code and headers are received.

Its nearly midnight where I am right now, so I don't think I'll be digging into
the C code for the next 12 hours or so, but if you have any suggestions (or a
fix...), that would be good..

BTW - I've tried this with 7.7.1, 7.7.2 and the current (as of a couple of hours
ago) CVS version - same results...

Cheers,

Cris Bailiff
c.bailiff_at_awayweb.com
Received on 2001-04-30