aboutsummaryrefslogtreecommitdiffstats
path: root/lib/getinfo.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-09-20 17:00:17 -0700
committerElliott Hughes <enh@google.com>2017-09-21 09:38:15 -0700
commit82be86df6ec7baa34d6169c053fd1dfe56fa858e (patch)
treeafd04b931f1f59dfe81b0daa450306ff0204319b /lib/getinfo.c
parentbfa505f61d33429f40bf843b7871fc793dd017d4 (diff)
downloadexternal_curl-82be86df6ec7baa34d6169c053fd1dfe56fa858e.tar.gz
external_curl-82be86df6ec7baa34d6169c053fd1dfe56fa858e.tar.bz2
external_curl-82be86df6ec7baa34d6169c053fd1dfe56fa858e.zip
Update libcurl from 7.54.1 to 7.55.1.
Bug: http://b/64610131 Test: builds, boots, `vendor/google/tools/fake-ota on streaming` works Change-Id: I7ecaf9c83e9496ac4a379507791bec637deaa4cb
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r--lib/getinfo.c60
1 files changed, 51 insertions, 9 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 4459a486..dc3a107e 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -78,6 +78,9 @@ CURLcode Curl_initinfo(struct Curl_easy *data)
info->conn_primary_port = 0;
info->conn_local_port = 0;
+ info->conn_scheme = 0;
+ info->conn_protocol = 0;
+
#ifdef USE_SSL
Curl_ssl_free_certinfo(data);
#endif
@@ -217,7 +220,7 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
*param_longp = data->state.rtsp_CSeq_recv;
break;
case CURLINFO_HTTP_VERSION:
- switch (data->info.httpversion) {
+ switch(data->info.httpversion) {
case 10:
*param_longp = CURL_HTTP_VERSION_1_0;
break;
@@ -243,27 +246,60 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
return CURLE_OK;
}
+#define DOUBLE_SECS(x) (double)(x)/1000000
+
+static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
+ curl_off_t *param_offt)
+{
+ switch(info) {
+ case CURLINFO_SIZE_UPLOAD_T:
+ *param_offt = data->progress.uploaded;
+ break;
+ case CURLINFO_SIZE_DOWNLOAD_T:
+ *param_offt = data->progress.downloaded;
+ break;
+ case CURLINFO_SPEED_DOWNLOAD_T:
+ *param_offt = data->progress.dlspeed;
+ break;
+ case CURLINFO_SPEED_UPLOAD_T:
+ *param_offt = data->progress.ulspeed;
+ break;
+ case CURLINFO_CONTENT_LENGTH_DOWNLOAD_T:
+ *param_offt = (data->progress.flags & PGRS_DL_SIZE_KNOWN)?
+ data->progress.size_dl:-1;
+ break;
+ case CURLINFO_CONTENT_LENGTH_UPLOAD_T:
+ *param_offt = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
+ data->progress.size_ul:-1;
+ break;
+ default:
+ return CURLE_UNKNOWN_OPTION;
+ }
+
+ return CURLE_OK;
+}
+
static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
double *param_doublep)
{
switch(info) {
case CURLINFO_TOTAL_TIME:
- *param_doublep = data->progress.timespent;
+ *param_doublep = DOUBLE_SECS(data->progress.timespent);
break;
case CURLINFO_NAMELOOKUP_TIME:
- *param_doublep = data->progress.t_nslookup;
+ *param_doublep = DOUBLE_SECS(data->progress.t_nslookup);
break;
case CURLINFO_CONNECT_TIME:
- *param_doublep = data->progress.t_connect;
+ *param_doublep = DOUBLE_SECS(data->progress.t_connect);
break;
case CURLINFO_APPCONNECT_TIME:
- *param_doublep = data->progress.t_appconnect;
+ *param_doublep = DOUBLE_SECS(data->progress.t_appconnect);
break;
case CURLINFO_PRETRANSFER_TIME:
- *param_doublep = data->progress.t_pretransfer;
+ *param_doublep = DOUBLE_SECS(data->progress.t_pretransfer);
break;
case CURLINFO_STARTTRANSFER_TIME:
- *param_doublep = data->progress.t_starttransfer;
+ *param_doublep = DOUBLE_SECS(data->progress.t_starttransfer);
break;
case CURLINFO_SIZE_UPLOAD:
*param_doublep = (double)data->progress.uploaded;
@@ -286,7 +322,7 @@ static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
(double)data->progress.size_ul:-1;
break;
case CURLINFO_REDIRECT_TIME:
- *param_doublep = data->progress.t_redirect;
+ *param_doublep = DOUBLE_SECS(data->progress.t_redirect);
break;
default:
@@ -391,6 +427,7 @@ CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...)
va_list arg;
long *param_longp = NULL;
double *param_doublep = NULL;
+ curl_off_t *param_offt = NULL;
const char **param_charp = NULL;
struct curl_slist **param_slistp = NULL;
curl_socket_t *param_socketp = NULL;
@@ -419,6 +456,11 @@ CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...)
if(param_doublep)
result = getinfo_double(data, info, param_doublep);
break;
+ case CURLINFO_OFF_T:
+ param_offt = va_arg(arg, curl_off_t *);
+ if(param_offt)
+ result = getinfo_offt(data, info, param_offt);
+ break;
case CURLINFO_SLIST:
param_slistp = va_arg(arg, struct curl_slist **);
if(param_slistp)