cURL / Mailing Lists / curl-library / Single Mail

curl-library

why is file size 0?

From: Tay Ray Chuan <rctay89_at_gmail.com>
Date: Sun, 12 Apr 2009 19:46:27 +0800

Hi,

I'm working on cygwin with 7.16.3.

---
	double size;
	CURL *session;
	CURLcode result;
	session = curl_easy_init();
	curl_easy_setopt(session, CURLOPT_NOBODY, 1);
	curl_easy_setopt(session, CURLOPT_URL, url);
	curl_easy_setopt(session, CURLOPT_VERBOSE, 1);
	result = curl_easy_perform(session);
	curl_easy_getinfo(session, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &size);
	if (result != CURLE_OK) {
		fprintf(stderr, "Unable to get size of %s\n", hex);
		goto abort;
	}
	fprintf(stdout, "size is %d\n", size);
	curl_easy_cleanup(session);
---
the output shows that the server does indeed include the
Content-Length (and non-null at that), but size is 0. What could be
the problem?
-- 
Cheers,
Ray Chuan
Received on 2009-04-12