aboutsummaryrefslogtreecommitdiffstats
path: root/lib/getinfo.c
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-04-29 13:49:57 -0700
committerHaibo Huang <hhb@google.com>2020-04-29 14:16:24 -0700
commit24c77a17e5380687755385e116cc407b9e0cdac5 (patch)
treee932df98deeb78b7fe8615fe094739eda91b8956 /lib/getinfo.c
parent217d07615e14335a54eeee5fb4478f4125487514 (diff)
downloadexternal_curl-24c77a17e5380687755385e116cc407b9e0cdac5.tar.gz
external_curl-24c77a17e5380687755385e116cc407b9e0cdac5.tar.bz2
external_curl-24c77a17e5380687755385e116cc407b9e0cdac5.zip
Upgrade curl to curl-7_70_0
Change-Id: I898f9e257c9b950ed79ccd16c4129ab58fd65f98
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r--lib/getinfo.c80
1 files changed, 76 insertions, 4 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 2b8f2303..84d9fc1c 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, 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
@@ -147,6 +147,33 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
long *to_long;
} lptr;
+#ifdef DEBUGBUILD
+ char *timestr = getenv("CURL_TIME");
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10);
+ switch(info) {
+ case CURLINFO_LOCAL_PORT:
+ *param_longp = (long)val;
+ return CURLE_OK;
+ default:
+ break;
+ }
+ }
+ /* use another variable for this to allow different values */
+ timestr = getenv("CURL_DEBUG_SIZE");
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10);
+ switch(info) {
+ case CURLINFO_HEADER_SIZE:
+ case CURLINFO_REQUEST_SIZE:
+ *param_longp = (long)val;
+ return CURLE_OK;
+ default:
+ break;
+ }
+ }
+#endif
+
switch(info) {
case CURLINFO_RESPONSE_CODE:
*param_longp = data->info.httpcode;
@@ -212,8 +239,11 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
*param_longp = data->info.conn_local_port;
break;
case CURLINFO_CONDITION_UNMET:
- /* return if the condition prevented the document to get transferred */
- *param_longp = data->info.timecond ? 1L : 0L;
+ if(data->info.httpcode == 304)
+ *param_longp = 1L;
+ else
+ /* return if the condition prevented the document to get transferred */
+ *param_longp = data->info.timecond ? 1L : 0L;
break;
case CURLINFO_RTSP_CLIENT_CSEQ:
*param_longp = data->state.rtsp_next_client_CSeq;
@@ -258,6 +288,27 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
curl_off_t *param_offt)
{
+#ifdef DEBUGBUILD
+ char *timestr = getenv("CURL_TIME");
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10);
+ switch(info) {
+ case CURLINFO_TOTAL_TIME_T:
+ case CURLINFO_NAMELOOKUP_TIME_T:
+ case CURLINFO_CONNECT_TIME_T:
+ case CURLINFO_APPCONNECT_TIME_T:
+ case CURLINFO_PRETRANSFER_TIME_T:
+ case CURLINFO_STARTTRANSFER_TIME_T:
+ case CURLINFO_REDIRECT_TIME_T:
+ case CURLINFO_SPEED_DOWNLOAD_T:
+ case CURLINFO_SPEED_UPLOAD_T:
+ *param_offt = (curl_off_t)val;
+ return CURLE_OK;
+ default:
+ break;
+ }
+ }
+#endif
switch(info) {
case CURLINFO_FILETIME_T:
*param_offt = (curl_off_t)data->info.filetime;
@@ -282,7 +333,7 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
*param_offt = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
data->progress.size_ul:-1;
break;
- case CURLINFO_TOTAL_TIME_T:
+ case CURLINFO_TOTAL_TIME_T:
*param_offt = data->progress.timespent;
break;
case CURLINFO_NAMELOOKUP_TIME_T:
@@ -316,6 +367,27 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
double *param_doublep)
{
+#ifdef DEBUGBUILD
+ char *timestr = getenv("CURL_TIME");
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10);
+ switch(info) {
+ case CURLINFO_TOTAL_TIME:
+ case CURLINFO_NAMELOOKUP_TIME:
+ case CURLINFO_CONNECT_TIME:
+ case CURLINFO_APPCONNECT_TIME:
+ case CURLINFO_PRETRANSFER_TIME:
+ case CURLINFO_STARTTRANSFER_TIME:
+ case CURLINFO_REDIRECT_TIME:
+ case CURLINFO_SPEED_DOWNLOAD:
+ case CURLINFO_SPEED_UPLOAD:
+ *param_doublep = (double)val;
+ return CURLE_OK;
+ default:
+ break;
+ }
+ }
+#endif
switch(info) {
case CURLINFO_TOTAL_TIME:
*param_doublep = DOUBLE_SECS(data->progress.timespent);