mirror of
https://github.com/curl/curl.git
synced 2026-08-26 14:53:33 +03:00
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
This commit is contained in:
parent
54789f9444
commit
ba410f6c64
10 changed files with 150 additions and 4 deletions
|
|
@ -59,6 +59,7 @@ typedef enum {
|
|||
VAR_LOCAL_IP,
|
||||
VAR_LOCAL_PORT,
|
||||
VAR_HTTP_VERSION,
|
||||
VAR_SCHEME,
|
||||
VAR_NUM_OF_VARS /* must be the last */
|
||||
} replaceid;
|
||||
|
||||
|
|
@ -99,6 +100,7 @@ static const struct variable replacements[]={
|
|||
{"local_ip", VAR_LOCAL_IP},
|
||||
{"local_port", VAR_LOCAL_PORT},
|
||||
{"http_version", VAR_HTTP_VERSION},
|
||||
{"scheme", VAR_SCHEME},
|
||||
{NULL, VAR_NONE}
|
||||
};
|
||||
|
||||
|
|
@ -308,6 +310,12 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
|
|||
fprintf(stream, version);
|
||||
}
|
||||
break;
|
||||
case VAR_SCHEME:
|
||||
if(CURLE_OK ==
|
||||
curl_easy_getinfo(curl, CURLINFO_SCHEME,
|
||||
&stringp))
|
||||
fprintf(stream, "%s", stringp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue