aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-06-06 17:33:35 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-06-06 17:33:35 +0000
commit930a45e7a93c964ec224bdddb59f97479b7e4a5d (patch)
treed567e363980655d50c73408540262b6ddaa3fff2 /tests
parentafc66554d7225766a7b9ad773de38b9d0801ff84 (diff)
- Added CURLINFO_PRIMARY_IP as a new information retrievable with
curl_easy_getinfo. It returns a pointer to a string with the most recently used IP address. Modified test case 500 to also verify this feature. The implementing of this feature was sponsored by Lenny Rachitsky at NeuStar.
Diffstat (limited to 'tests')
-rw-r--r--tests/data/test5005
-rw-r--r--tests/libtest/lib500.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/tests/data/test500 b/tests/data/test500
index bf4407fea..33a3a7959 100644
--- a/tests/data/test500
+++ b/tests/data/test500
@@ -32,13 +32,16 @@ lib500
simple libcurl HTTP GET tool
</name>
<command>
-http://%HOSTIP:%HTTPPORT/500
+http://%HOSTIP:%HTTPPORT/500 log/ip500
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
+<file name="log/ip500" mode="text">
+IP: %HOSTIP
+</file>
<protocol>
GET /500 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c
index d22aecdbc..c28f5d0c9 100644
--- a/tests/libtest/lib500.c
+++ b/tests/libtest/lib500.c
@@ -14,6 +14,7 @@ int test(char *URL)
{
CURLcode res;
CURL *curl;
+ char *ipstr=NULL;
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
@@ -31,7 +32,17 @@ int test(char *URL)
res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
+ if(!res) {
+ FILE *moo;
+ res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ipstr);
+ moo = fopen(libtest_arg2, "wb");
+ if(moo) {
+ fprintf(moo, "IP: %s\n", ipstr);
+ fclose(moo);
+ }
+ }
+
+ curl_easy_cleanup(curl);
curl_global_cleanup();
return (int)res;