summaryrefslogtreecommitdiff
path: root/lib/getinfo.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2016-11-23 10:44:18 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-11-25 00:45:18 +0100
commitba410f6c64af26292d1dc549829c25af5602fbf7 (patch)
treec48cefe5f5626983fab185baeec1970a6c53f45f /lib/getinfo.c
parent54789f94448e1a624f02cb4e4e739afe4a687656 (diff)
downloadcurl-ba410f6c64af26292d1dc549829c25af5602fbf7.tar.gz
add CURLINFO_SCHEME, CURLINFO_PROTOCOL, and %{scheme}
Adds access to the effectively used protocol/scheme to both libcurl and curl, both in string and numeric (CURLPROTO_*) form. Note that the string form will be uppercase, as it is just the internal string. As these strings are declared internally as const, and all other strings returned by curl_easy_getinfo() are de-facto const as well, string handling in getinfo.c got const-ified. Closes #1137
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r--lib/getinfo.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 7dcc71d33..4459a486b 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -86,7 +86,7 @@ CURLcode Curl_initinfo(struct Curl_easy *data)
}
static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
- char **param_charp)
+ const char **param_charp)
{
switch(info) {
case CURLINFO_EFFECTIVE_URL:
@@ -123,6 +123,9 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
case CURLINFO_RTSP_SESSION_ID:
*param_charp = data->set.str[STRING_RTSP_SESSION_ID];
break;
+ case CURLINFO_SCHEME:
+ *param_charp = data->info.conn_scheme;
+ break;
default:
return CURLE_UNKNOWN_OPTION;
@@ -229,6 +232,9 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
break;
}
break;
+ case CURLINFO_PROTOCOL:
+ *param_longp = data->info.conn_protocol;
+ break;
default:
return CURLE_UNKNOWN_OPTION;
@@ -385,7 +391,7 @@ CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...)
va_list arg;
long *param_longp = NULL;
double *param_doublep = NULL;
- char **param_charp = NULL;
+ const char **param_charp = NULL;
struct curl_slist **param_slistp = NULL;
curl_socket_t *param_socketp = NULL;
int type;
@@ -399,7 +405,7 @@ CURLcode Curl_getinfo(struct Curl_easy *data, CURLINFO info, ...)
type = CURLINFO_TYPEMASK & (int)info;
switch(type) {
case CURLINFO_STRING:
- param_charp = va_arg(arg, char **);
+ param_charp = va_arg(arg, const char **);
if(param_charp)
result = getinfo_char(data, info, param_charp);
break;