1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

- After a bug reported by James Cheng I've made curl_easy_getinfo() for

CURLINFO_CONTENT_LENGTH_DOWNLOAD and CURLINFO_CONTENT_LENGTH_UPLOAD return
  -1 if the sizes aren't know. Previously these returned 0, make it impossible
  to detect the difference between actually zero and unknown.
This commit is contained in:
Daniel Stenberg 2009-02-23 18:45:00 +00:00
parent 735955282b
commit 6c9f37d263
5 changed files with 18 additions and 8 deletions

View File

@ -6,6 +6,12 @@
Changelog
Daniel Stenberg (23 Feb 2009)
- After a bug reported by James Cheng I've made curl_easy_getinfo() for
CURLINFO_CONTENT_LENGTH_DOWNLOAD and CURLINFO_CONTENT_LENGTH_UPLOAD return
-1 if the sizes aren't know. Previously these returned 0, make it impossible
to detect the difference between actually zero and unknown.
Yang Tse (23 Feb 2009)
- Daniel Johnson provided a shell script that will perform all the steps needed
to build a Mac OS X fat ppc/i386 or ppc64/x86_64 libcurl.framework

View File

@ -41,6 +41,8 @@ This release includes the following bugfixes:
easily on transfer failures
o compilation halting when using VS2008 to build a Windows 2000 target
o ease creation of libcurl Mac OS X Framework
o CURLINFO_CONTENT_LENGTH_DOWNLOAD and CURLINFO_CONTENT_LENGTH_UPLOAD are -1
if unknown
This release includes the following known bugs:
@ -53,6 +55,6 @@ advice from friends like these:
Peter Sylvester, Chad Monroe, Markus Moeller, Yang Tse, Scott Cantor,
Patrick Scott, Hidemoto Nakada, Jocelyn Jaubert, Andre Guibert de Bruet,
Kamil Dudka, Patrik Thunstrom, Linus Nielsen Feltzing, Mark Incley,
Daniel Johnson
Daniel Johnson, James Cheng
Thanks! (and sorry if I forgot to mention someone)

View File

@ -8,9 +8,6 @@ To be addressed in 7.19.4 (planned release: March 2009)
218 - Senthil Raja Velu's "CURLOPT_LOCALPORT option broken", patch by
Markus Koetter
219 - James Cheng's bug "How to detect missing Content-Length response header?"
To be addressed in 7.19.5 (planned release: May 2009)
=========================

View File

@ -134,9 +134,11 @@ on the list pointer once you're done with it, as libcurl will not free the
data for you. (Added in 7.12.3)
.IP CURLINFO_CONTENT_LENGTH_DOWNLOAD
Pass a pointer to a double to receive the content-length of the download. This
is the value read from the Content-Length: field.
is the value read from the Content-Length: field. Since 7.19.4, this returns -1
if the size isn't known.
.IP CURLINFO_CONTENT_LENGTH_UPLOAD
Pass a pointer to a double to receive the specified size of the upload.
Pass a pointer to a double to receive the specified size of the upload. Since
7.19.4, this returns -1 if the size isn't known.
.IP CURLINFO_CONTENT_TYPE
Pass a pointer to a 'char *' to receive the content-type of the downloaded
object. This is the value read from the Content-Type: field. If you get NULL,

View File

@ -35,6 +35,7 @@
#include "memory.h"
#include "sslgen.h"
#include "connect.h" /* Curl_getconnectinfo() */
#include "progress.h"
/* Make this the last #include */
#include "memdebug.h"
@ -167,10 +168,12 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
*param_longp = data->set.ssl.certverifyresult;
break;
case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
*param_doublep = (double)data->progress.size_dl;
*param_doublep = (data->progress.flags & PGRS_DL_SIZE_KNOWN)?
(double)data->progress.size_dl:-1;
break;
case CURLINFO_CONTENT_LENGTH_UPLOAD:
*param_doublep = (double)data->progress.size_ul;
*param_doublep = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
(double)data->progress.size_ul:-1;
break;
case CURLINFO_REDIRECT_TIME:
*param_doublep = data->progress.t_redirect;