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 /lib | |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/getinfo.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; |