cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

Re: How to detect missing Content-Length response header?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 20 Feb 2009 12:03:08 +0100 (CET)

On Thu, 19 Feb 2009, James Cheng wrote:

> I'm using curl_easy_getinfo() with CURLINFO_CONTENT_LENGTH_DOWNLOAD in order
> to get the value of Content-Length. If the Content-Length header was not
> present in the response headers at all, curl still returns "0" with
> curl_easy_getinfo() returning CURLE_OK. That means there's no built-in way
> to detect Content-Length actually being 0, vs the Content-Length header not
> being sent.

Oh indeed. I consider that a bug. How would you prefer it to act?

> Is there some other mechanism? If not, it looks like I'll have to check for
> the headers as they come in, using the HEADERFUNCTION callback.

I figure given the flaw mentioned about that's the most reliable way.

-- 
  / daniel.haxx.se
Received on 2009-02-20

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET