summaryrefslogtreecommitdiff
path: root/src/tool_writeout.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-07-13 09:58:29 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-07-14 17:53:45 +0200
commitf5e6907d5232ca9c05cb8a0b99d809590ddcde18 (patch)
treeca196f63279e191890bc0feb5a3ba510ce59cc84 /src/tool_writeout.c
parentd75e3ab74c91eff67363cba064611d405105a12f (diff)
downloadcurl-f5e6907d5232ca9c05cb8a0b99d809590ddcde18.tar.gz
curl: add %{method} to the -w variables
Gets the CURLINFO_EFFECTIVE_METHOD from libcurl. Added test 1197 to verify.
Diffstat (limited to 'src/tool_writeout.c')
-rw-r--r--src/tool_writeout.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tool_writeout.c b/src/tool_writeout.c
index d8ccbcbda..41441ff30 100644
--- a/src/tool_writeout.c
+++ b/src/tool_writeout.c
@@ -32,6 +32,8 @@
static const struct writeoutvar variables[] = {
{"url_effective", VAR_EFFECTIVE_URL, 0,
CURLINFO_EFFECTIVE_URL, JSON_STRING},
+ {"method", VAR_EFFECTIVE_METHOD, 0,
+ CURLINFO_EFFECTIVE_METHOD, JSON_STRING},
{"http_code", VAR_HTTP_CODE, 0,
CURLINFO_RESPONSE_CODE, JSON_LONG},
{"response_code", VAR_HTTP_CODE, 0,
@@ -142,6 +144,13 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
&& stringp)
fputs(stringp, stream);
break;
+ case VAR_EFFECTIVE_METHOD:
+ if((CURLE_OK == curl_easy_getinfo(curl,
+ CURLINFO_EFFECTIVE_METHOD,
+ &stringp))
+ && stringp)
+ fputs(stringp, stream);
+ break;
case VAR_HTTP_CODE:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &longinfo))