curl-library
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)
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.seReceived on 2009-02-20