commit fe7ed03a632fb960bef5b5ba5ea23b07c8c2d397 parent b6f6b9a5cc5d2459efd18cd206e79ffa976d5a3d Author: Christian Grothoff <christian@grothoff.org> Date: Thu, 29 Sep 2011 15:04:50 +0000 use 127.0.0.1 instead of localhost for testcurl/*.c; performs far better on OS X and Solaris-style kernels Will Bryant (<will.bryant@gmail.com>) writes: On 21/09/2011, at 20:14 , Christian Grothoff wrote: > > On the OpenIndiana performance, do you have something like 'strace' where you > > could monitor what's going on? Most likely the code hangs blocking in some > > syscall for longer than it should... It has truss, and for the record, it showed no slow calls. The problem turned out to be the tests using "localhost", which was picking the primary interface for the box, not the loopback interface. Changing perf_get_concurrent.c to use 127.0.0.1 makes it vastly faster - it went from ~35 requests/sec to 12,000-15,000 requests/sec. It makes a big difference on OS X too - from 115-140 requests/sec on my old macbook to 600-3600 requests/sec (variation here mainly due to the large amount of other stuff I have running). Patch attached. Diffstat:
24 files changed, 69 insertions(+), 69 deletions(-)
diff --git a/src/testcurl/daemontest_digestauth.c b/src/testcurl/daemontest_digestauth.c @@ -165,7 +165,7 @@ testDigestAuth () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1337/"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1337/"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); diff --git a/src/testcurl/daemontest_get.c b/src/testcurl/daemontest_get.c @@ -113,7 +113,7 @@ testInternalGet (int poll_flag) if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -162,7 +162,7 @@ testMultithreadedGet (int poll_flag) if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -212,7 +212,7 @@ testMultithreadedPoolGet (int poll_flag) if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -271,7 +271,7 @@ testExternalGet () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -403,7 +403,7 @@ testUnknownPortGet (int poll_flag) if (addr.sin_family != AF_INET) return 26214; - snprintf(buf, sizeof(buf), "http://localhost:%hu/hello_world", + snprintf(buf, sizeof(buf), "http://127.0.0.1:%hu/hello_world", ntohs(addr.sin_port)); c = curl_easy_init (); diff --git a/src/testcurl/daemontest_get_chunked.c b/src/testcurl/daemontest_get_chunked.c @@ -162,7 +162,7 @@ testInternalGet () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -204,7 +204,7 @@ testMultithreadedGet () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -247,7 +247,7 @@ testMultithreadedPoolGet () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -299,7 +299,7 @@ testExternalGet () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); diff --git a/src/testcurl/daemontest_get_response_cleanup.c b/src/testcurl/daemontest_get_response_cleanup.c @@ -140,7 +140,7 @@ testInternalGet () 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 1; - curl = fork_curl ("http://localhost:11080/"); + curl = fork_curl ("http://127.0.0.1:11080/"); sleep (1); kill_curl (curl); sleep (1); @@ -165,11 +165,11 @@ testMultithreadedGet () return 16; ok = 1; //fprintf (stderr, "Forking cURL!\n"); - curl = fork_curl ("http://localhost:1081/"); + curl = fork_curl ("http://127.0.0.1:1081/"); sleep (1); kill_curl (curl); sleep (1); - curl = fork_curl ("http://localhost:1081/"); + curl = fork_curl ("http://127.0.0.1:1081/"); sleep (1); if (ok != 0) { @@ -199,7 +199,7 @@ testMultithreadedPoolGet () if (d == NULL) return 64; ok = 1; - curl = fork_curl ("http://localhost:1081/"); + curl = fork_curl ("http://127.0.0.1:1081/"); sleep (1); kill_curl (curl); sleep (1); @@ -226,7 +226,7 @@ testExternalGet () 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); if (d == NULL) return 256; - curl = fork_curl ("http://localhost:1082/"); + curl = fork_curl ("http://127.0.0.1:1082/"); start = time (NULL); while ((time (NULL) - start < 2)) diff --git a/src/testcurl/daemontest_get_sendfile.c b/src/testcurl/daemontest_get_sendfile.c @@ -121,7 +121,7 @@ testInternalGet () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11080/"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11080/"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -170,7 +170,7 @@ testMultithreadedGet () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -220,7 +220,7 @@ testMultithreadedPoolGet () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -279,7 +279,7 @@ testExternalGet () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -411,7 +411,7 @@ testUnknownPortGet () if (addr.sin_family != AF_INET) return 26214; - snprintf(buf, sizeof(buf), "http://localhost:%hu/", + snprintf(buf, sizeof(buf), "http://127.0.0.1:%hu/", ntohs(addr.sin_port)); c = curl_easy_init (); diff --git a/src/testcurl/daemontest_iplimit.c b/src/testcurl/daemontest_iplimit.c @@ -124,7 +124,7 @@ testMultithreadedGet () cbc[i].size = 2048; cbc[i].pos = 0; - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc[i]); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -222,7 +222,7 @@ testMultithreadedPoolGet () cbc[i].size = 2048; cbc[i].pos = 0; - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc[i]); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); diff --git a/src/testcurl/daemontest_large_put.c b/src/testcurl/daemontest_large_put.c @@ -153,7 +153,7 @@ testInternalPut () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -211,7 +211,7 @@ testMultithreadedPut () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -273,7 +273,7 @@ testMultithreadedPoolPut () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -344,7 +344,7 @@ testExternalPut () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); diff --git a/src/testcurl/daemontest_long_header.c b/src/testcurl/daemontest_long_header.c @@ -120,7 +120,7 @@ testLongUrlGet () } memset (url, 'a', VERY_LONG); url[VERY_LONG - 1] = '\0'; - memcpy (url, "http://localhost:1080/", strlen ("http://localhost:1080/")); + memcpy (url, "http://127.0.0.1:1080/", strlen ("http://127.0.0.1:1080/")); curl_easy_setopt (c, CURLOPT_URL, url); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); @@ -196,7 +196,7 @@ testLongHeaderGet () header = curl_slist_append (header, url); curl_easy_setopt (c, CURLOPT_HTTPHEADER, header); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); diff --git a/src/testcurl/daemontest_parse_cookies.c b/src/testcurl/daemontest_parse_cookies.c @@ -132,7 +132,7 @@ testExternalGet () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:21080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:21080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); diff --git a/src/testcurl/daemontest_post.c b/src/testcurl/daemontest_post.c @@ -144,7 +144,7 @@ testInternalPost () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); @@ -196,7 +196,7 @@ testMultithreadedPost () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); @@ -249,7 +249,7 @@ testMultithreadedPoolPost () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); @@ -311,7 +311,7 @@ testExternalPost () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); @@ -516,7 +516,7 @@ testMultithreadedPostCancelPart(int flags) crbc.pos = 0; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, (flags & FLAG_SLOW_READ) ? &slowReadBuffer : &readBuffer); diff --git a/src/testcurl/daemontest_post_loop.c b/src/testcurl/daemontest_post_loop.c @@ -122,7 +122,7 @@ testInternalPost () c = curl_easy_init (); cbc.pos = 0; buf[0] = '\0'; - sprintf (url, "http://localhost:1080/hw%d", i); + sprintf (url, "http://127.0.0.1:1080/hw%d", i); curl_easy_setopt (c, CURLOPT_URL, url); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); @@ -186,7 +186,7 @@ testMultithreadedPost () c = curl_easy_init (); cbc.pos = 0; buf[0] = '\0'; - sprintf (url, "http://localhost:1081/hw%d", i); + sprintf (url, "http://127.0.0.1:1081/hw%d", i); curl_easy_setopt (c, CURLOPT_URL, url); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); @@ -251,7 +251,7 @@ testMultithreadedPoolPost () c = curl_easy_init (); cbc.pos = 0; buf[0] = '\0'; - sprintf (url, "http://localhost:1081/hw%d", i); + sprintf (url, "http://127.0.0.1:1081/hw%d", i); curl_easy_setopt (c, CURLOPT_URL, url); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); @@ -333,7 +333,7 @@ testExternalPost () c = curl_easy_init (); cbc.pos = 0; buf[0] = '\0'; - sprintf (url, "http://localhost:1082/hw%d", i); + sprintf (url, "http://127.0.0.1:1082/hw%d", i); curl_easy_setopt (c, CURLOPT_URL, url); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); diff --git a/src/testcurl/daemontest_postform.c b/src/testcurl/daemontest_postform.c @@ -161,7 +161,7 @@ testInternalPost () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); pd = make_form (); @@ -215,7 +215,7 @@ testMultithreadedPost () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); pd = make_form (); @@ -270,7 +270,7 @@ testMultithreadedPoolPost () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); pd = make_form (); @@ -334,7 +334,7 @@ testExternalPost () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); pd = make_form (); diff --git a/src/testcurl/daemontest_process_arguments.c b/src/testcurl/daemontest_process_arguments.c @@ -126,7 +126,7 @@ testExternalGet () return 256; c = curl_easy_init (); curl_easy_setopt (c, CURLOPT_URL, - "http://localhost:21080/hello_world?k=v+x&hash=%23"); + "http://127.0.0.1:21080/hello_world?k=v+x&hash=%23"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); diff --git a/src/testcurl/daemontest_process_headers.c b/src/testcurl/daemontest_process_headers.c @@ -62,7 +62,7 @@ static int kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value) { if ((0 == strcmp (key, MHD_HTTP_HEADER_HOST)) && - (0 == strcmp (value, "localhost:21080")) && (kind == MHD_HEADER_KIND)) + (0 == strcmp (value, "127.0.0.1:21080")) && (kind == MHD_HEADER_KIND)) { *((int *) cls) = 1; return MHD_NO; @@ -106,7 +106,7 @@ ahc_echo (void *cls, abort (); hdr = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_HOST); - if ((hdr == NULL) || (0 != strcmp (hdr, "localhost:21080"))) + if ((hdr == NULL) || (0 != strcmp (hdr, "127.0.0.1:21080"))) abort (); MHD_set_connection_value (connection, MHD_HEADER_KIND, "FakeHeader", "NowPresent"); @@ -155,7 +155,7 @@ testInternalGet () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:21080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:21080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -204,7 +204,7 @@ testMultithreadedGet () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:21080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:21080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -254,7 +254,7 @@ testMultithreadedPoolGet () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:21080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:21080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); @@ -313,7 +313,7 @@ testExternalGet () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:21080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:21080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); diff --git a/src/testcurl/daemontest_put.c b/src/testcurl/daemontest_put.c @@ -130,7 +130,7 @@ testInternalPut () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -186,7 +186,7 @@ testMultithreadedPut () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -244,7 +244,7 @@ testMultithreadedPoolPut () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -312,7 +312,7 @@ testExternalPut () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); diff --git a/src/testcurl/daemontest_put_chunked.c b/src/testcurl/daemontest_put_chunked.c @@ -140,7 +140,7 @@ testInternalPut () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -196,7 +196,7 @@ testMultithreadedPut () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -254,7 +254,7 @@ testMultithreadedPoolPut () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -322,7 +322,7 @@ testExternalPut () if (d == NULL) return 256; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11082/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11082/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); diff --git a/src/testcurl/daemontest_termination.c b/src/testcurl/daemontest_termination.c @@ -98,7 +98,7 @@ main () CURL *curl = curl_easy_init (); //curl_easy_setopt(curl, CURLOPT_POST, 1L); char url[255]; - sprintf (url, "http://localhost:%d", PORT); + sprintf (url, "http://127.0.0.1:%d", PORT); curl_easy_setopt (curl, CURLOPT_URL, url); curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, write_data); diff --git a/src/testcurl/daemontest_timeout.c b/src/testcurl/daemontest_timeout.c @@ -144,7 +144,7 @@ testWithoutTimeout () if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); @@ -199,7 +199,7 @@ testWithTimeout () if (d == NULL) return 16; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1080/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer_fail); diff --git a/src/testcurl/daemontest_urlparse.c b/src/testcurl/daemontest_urlparse.c @@ -136,7 +136,7 @@ testInternalGet (int poll_flag) if (d == NULL) return 1; c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11080/hello_world?a=b&c=&d"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11080/hello_world?a=b&c=&d"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); diff --git a/src/testcurl/https/mhds_get_test_select.c b/src/testcurl/https/mhds_get_test_select.c @@ -108,7 +108,7 @@ testExternalGet () } c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "https://localhost:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1:1082/hello_world"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); /* TLS options */ diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c @@ -277,7 +277,7 @@ gen_test_file_url (char *url, int port) ret = -1; } /* construct url - this might use doc_path */ - if (sprintf (url, "%s:%d%s/%s", "https://localhost", port, + if (sprintf (url, "%s:%d%s/%s", "https://127.0.0.1", port, doc_path, "urlpath") < 0) ret = -1; diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c @@ -181,7 +181,7 @@ testInternalGet (int port, int poll_flag) unsigned int i; char url[64]; - sprintf(url, "http://localhost:%d/hello_world", port); + sprintf(url, "http://127.0.0.1:%d/hello_world", port); cbc.buf = buf; cbc.size = 2048; @@ -240,7 +240,7 @@ testMultithreadedGet (int port, int poll_flag) unsigned int i; char url[64]; - sprintf(url, "http://localhost:%d/hello_world", port); + sprintf(url, "http://127.0.0.1:%d/hello_world", port); cbc.buf = buf; cbc.size = 2048; @@ -298,7 +298,7 @@ testMultithreadedPoolGet (int port, int poll_flag) unsigned int i; char url[64]; - sprintf(url, "http://localhost:%d/hello_world", port); + sprintf(url, "http://127.0.0.1:%d/hello_world", port); cbc.buf = buf; cbc.size = 2048; @@ -366,7 +366,7 @@ testExternalGet (int port) unsigned int i; char url[64]; - sprintf(url, "http://localhost:%d/hello_world", port); + sprintf(url, "http://127.0.0.1:%d/hello_world", port); multi = NULL; cbc.buf = buf; diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c @@ -163,7 +163,7 @@ do_gets (int port) pid_t par[PAR]; char url[64]; - sprintf(url, "http://localhost:%d/hello_world", port); + sprintf(url, "http://127.0.0.1:%d/hello_world", port); ret = fork (); if (ret == -1) abort (); diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c @@ -105,7 +105,7 @@ int main(int argc, char **argv) NULL, MHD_OPTION_END); c = curl_easy_init (); - curl_easy_setopt (c, CURLOPT_URL, "http://localhost:8000/"); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:8000/"); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &discard_buffer); curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);