diff options
author | Daniel Stenberg <daniel@haxx.se> | 2012-11-07 23:30:25 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2013-01-03 23:16:38 +0100 |
commit | 65e8ba8e1d77f8a31cc7c9d424eee5880e3f08c8 (patch) | |
tree | 641bd37a8d68516b49afe7132da78193492bc23c /src/tool_writeout.c | |
parent | 0b3180b4f53d8f101974d5f039a21f0529c15601 (diff) | |
download | curl-65e8ba8e1d77f8a31cc7c9d424eee5880e3f08c8.tar.gz |
writeout: -w now supports remote_ip/port and local_ip/port
Added mention to the curl.1 man page.
Test case 1223 verifies remote_ip/port.
Diffstat (limited to 'src/tool_writeout.c')
-rw-r--r-- | src/tool_writeout.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/tool_writeout.c b/src/tool_writeout.c index bbb23af00..e84b7ef22 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -54,6 +54,10 @@ typedef enum { VAR_REDIRECT_URL, VAR_SSL_VERIFY_RESULT, VAR_EFFECTIVE_FILENAME, + VAR_PRIMARY_IP, + VAR_PRIMARY_PORT, + VAR_LOCAL_IP, + VAR_LOCAL_PORT, VAR_NUM_OF_VARS /* must be the last */ } replaceid; @@ -88,6 +92,10 @@ static const struct variable replacements[]={ {"redirect_url", VAR_REDIRECT_URL}, {"ssl_verify_result", VAR_SSL_VERIFY_RESULT}, {"filename_effective", VAR_EFFECTIVE_FILENAME}, + {"remote_ip", VAR_PRIMARY_IP}, + {"remote_port", VAR_PRIMARY_PORT}, + {"local_ip", VAR_LOCAL_IP}, + {"local_port", VAR_LOCAL_PORT}, {NULL, VAR_NONE} }; @@ -247,6 +255,30 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo) if(outs->filename) fprintf(stream, "%s", outs->filename); break; + case VAR_PRIMARY_IP: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, + &stringp)) + fprintf(stream, "%s", stringp); + break; + case VAR_PRIMARY_PORT: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, + &longinfo)) + fprintf(stream, "%ld", longinfo); + break; + case VAR_LOCAL_IP: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_LOCAL_IP, + &stringp)) + fprintf(stream, "%s", stringp); + break; + case VAR_LOCAL_PORT: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, + &longinfo)) + fprintf(stream, "%ld", longinfo); + break; default: break; } |