cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-420610 ] 304 response has no content - fix

From: <noreply_at_sourceforge.net>
Date: Tue, 01 May 2001 18:52:13 -0700

Bugs item #420610, was updated on 2001-05-01 18:52
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=420610&group_id=976

Category: libcurl
Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Cris Bailiff (crisb)
Assigned to: Daniel Stenberg (bagder)
Summary: 304 response has no content - fix

Initial Comment:
I've moved my mailing list report into an official bug,
with the patch as attachment. The patch fixes the
problem by setring the expected body size to '0' when a
304 response is received.

RFC2616 says that 304 response MUST NOT have a body.

----
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. 
 
----------------------------------------------------------------------
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=420610&group_id=976
Received on 2001-05-02