From 65e8ba8e1d77f8a31cc7c9d424eee5880e3f08c8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 7 Nov 2012 23:30:25 +0100 Subject: 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. --- src/tool_writeout.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/tool_writeout.c') 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; } -- cgit v1.2.3