summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/getinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/getinfo.c')
-rw-r--r--libs/libcurl/src/getinfo.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/libs/libcurl/src/getinfo.c b/libs/libcurl/src/getinfo.c
index a3f159e446..2e5c0d5cbe 100644
--- a/libs/libcurl/src/getinfo.c
+++ b/libs/libcurl/src/getinfo.c
@@ -28,10 +28,10 @@
#include "urldata.h"
#include "getinfo.h"
-
#include "vtls/vtls.h"
#include "connect.h" /* Curl_getconnectinfo() */
#include "progress.h"
+#include "curlx/strparse.h"
/* The last #include files should be: */
#include "curl_memory.h"
@@ -69,6 +69,8 @@ CURLcode Curl_initinfo(struct Curl_easy *data)
info->request_size = 0;
info->proxyauthavail = 0;
info->httpauthavail = 0;
+ info->proxyauthpicked = 0;
+ info->httpauthpicked = 0;
info->numconnects = 0;
free(info->contenttype);
@@ -96,7 +98,7 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
{
switch(info) {
case CURLINFO_EFFECTIVE_URL:
- *param_charp = data->state.url ? data->state.url : (char *)"";
+ *param_charp = data->state.url ? data->state.url : "";
break;
case CURLINFO_EFFECTIVE_METHOD: {
const char *m = data->set.str[STRING_CUSTOMREQUEST];
@@ -202,9 +204,10 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
} lptr;
#ifdef DEBUGBUILD
- char *timestr = getenv("CURL_TIME");
+ const char *timestr = getenv("CURL_TIME");
if(timestr) {
- unsigned long val = strtoul(timestr, NULL, 10);
+ curl_off_t val;
+ curlx_str_number(&timestr, &val, TIME_T_MAX);
switch(info) {
case CURLINFO_LOCAL_PORT:
*param_longp = (long)val;
@@ -216,7 +219,8 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
/* use another variable for this to allow different values */
timestr = getenv("CURL_DEBUG_SIZE");
if(timestr) {
- unsigned long val = strtoul(timestr, NULL, 10);
+ curl_off_t val;
+ curlx_str_number(&timestr, &val, LONG_MAX);
switch(info) {
case CURLINFO_HEADER_SIZE:
case CURLINFO_REQUEST_SIZE:
@@ -238,8 +242,10 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
case CURLINFO_FILETIME:
if(data->info.filetime > LONG_MAX)
*param_longp = LONG_MAX;
+#if !defined(MSDOS) && !defined(__AMIGA__)
else if(data->info.filetime < LONG_MIN)
*param_longp = LONG_MIN;
+#endif
else
*param_longp = (long)data->info.filetime;
break;
@@ -270,6 +276,14 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
lptr.to_long = param_longp;
*lptr.to_ulong = data->info.proxyauthavail;
break;
+ case CURLINFO_HTTPAUTH_USED:
+ lptr.to_long = param_longp;
+ *lptr.to_ulong = data->info.httpauthpicked;
+ break;
+ case CURLINFO_PROXYAUTH_USED:
+ lptr.to_long = param_longp;
+ *lptr.to_ulong = data->info.proxyauthpicked;
+ break;
case CURLINFO_OS_ERRNO:
*param_longp = data->state.os_errno;
break;
@@ -367,9 +381,11 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
curl_off_t *param_offt)
{
#ifdef DEBUGBUILD
- char *timestr = getenv("CURL_TIME");
+ const char *timestr = getenv("CURL_TIME");
if(timestr) {
- unsigned long val = strtoul(timestr, NULL, 10);
+ curl_off_t val;
+ curlx_str_number(&timestr, &val, CURL_OFF_T_MAX);
+
switch(info) {
case CURLINFO_TOTAL_TIME_T:
case CURLINFO_NAMELOOKUP_TIME_T:
@@ -377,6 +393,7 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
case CURLINFO_APPCONNECT_TIME_T:
case CURLINFO_PRETRANSFER_TIME_T:
case CURLINFO_POSTTRANSFER_TIME_T:
+ case CURLINFO_QUEUE_TIME_T:
case CURLINFO_STARTTRANSFER_TIME_T:
case CURLINFO_REDIRECT_TIME_T:
case CURLINFO_SPEED_DOWNLOAD_T:
@@ -405,11 +422,11 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
*param_offt = data->progress.ul.speed;
break;
case CURLINFO_CONTENT_LENGTH_DOWNLOAD_T:
- *param_offt = (data->progress.flags & PGRS_DL_SIZE_KNOWN) ?
+ *param_offt = data->progress.dl_size_known ?
data->progress.dl.total_size : -1;
break;
case CURLINFO_CONTENT_LENGTH_UPLOAD_T:
- *param_offt = (data->progress.flags & PGRS_UL_SIZE_KNOWN) ?
+ *param_offt = data->progress.ul_size_known ?
data->progress.ul.total_size : -1;
break;
case CURLINFO_TOTAL_TIME_T:
@@ -463,9 +480,11 @@ static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
double *param_doublep)
{
#ifdef DEBUGBUILD
- char *timestr = getenv("CURL_TIME");
+ const char *timestr = getenv("CURL_TIME");
if(timestr) {
- unsigned long val = strtoul(timestr, NULL, 10);
+ curl_off_t val;
+ curlx_str_number(&timestr, &val, CURL_OFF_T_MAX);
+
switch(info) {
case CURLINFO_TOTAL_TIME:
case CURLINFO_NAMELOOKUP_TIME:
@@ -515,11 +534,11 @@ static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
*param_doublep = (double)data->progress.ul.speed;
break;
case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
- *param_doublep = (data->progress.flags & PGRS_DL_SIZE_KNOWN) ?
+ *param_doublep = data->progress.dl_size_known ?
(double)data->progress.dl.total_size : -1;
break;
case CURLINFO_CONTENT_LENGTH_UPLOAD:
- *param_doublep = (data->progress.flags & PGRS_UL_SIZE_KNOWN) ?
+ *param_doublep = data->progress.ul_size_known ?
(double)data->progress.ul.total_size : -1;
break;
case CURLINFO_REDIRECT_TIME: