diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2009-02-23 18:45:00 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2009-02-23 18:45:00 +0000 | 
| commit | 6c9f37d263593bd72759cc2c0d275a3a9cd47b19 (patch) | |
| tree | 895bd918617eb82374d92943763c884e68b914b0 | |
| parent | 735955282bca7b650b97329bbadfafaf282f54d3 (diff) | |
- 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.
| -rw-r--r-- | CHANGES | 6 | ||||
| -rw-r--r-- | RELEASE-NOTES | 4 | ||||
| -rw-r--r-- | TODO-RELEASE | 3 | ||||
| -rw-r--r-- | docs/libcurl/curl_easy_getinfo.3 | 6 | ||||
| -rw-r--r-- | lib/getinfo.c | 7 | 
5 files changed, 18 insertions, 8 deletions
@@ -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 diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1dda26972..a5a722123 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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) diff --git a/TODO-RELEASE b/TODO-RELEASE index 6bf1187ef..c5443870b 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -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)  ========================= diff --git a/docs/libcurl/curl_easy_getinfo.3 b/docs/libcurl/curl_easy_getinfo.3 index 6c999cb7d..63aea1b84 100644 --- a/docs/libcurl/curl_easy_getinfo.3 +++ b/docs/libcurl/curl_easy_getinfo.3 @@ -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, diff --git a/lib/getinfo.c b/lib/getinfo.c index bc387c960..4aa813797 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -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;  | 
