From 6c9f37d263593bd72759cc2c0d275a3a9cd47b19 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 23 Feb 2009 18:45:00 +0000 Subject: - 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. --- lib/getinfo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/getinfo.c') 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; -- cgit v1.2.3