aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/test_urlparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/test_urlparse.c')
-rw-r--r--src/testcurl/test_urlparse.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c
index 9c1e64a8..980a46b2 100644
--- a/src/testcurl/test_urlparse.c
+++ b/src/testcurl/test_urlparse.c
@@ -130,16 +130,35 @@ testInternalGet (int poll_flag)
130 char buf[2048]; 130 char buf[2048];
131 struct CBC cbc; 131 struct CBC cbc;
132 CURLcode errornum; 132 CURLcode errornum;
133 int port;
134
135 if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
136 port = 0;
137 else
138 {
139 port = 1510;
140 if (oneone)
141 port += 5;
142 }
133 143
134 cbc.buf = buf; 144 cbc.buf = buf;
135 cbc.size = 2048; 145 cbc.size = 2048;
136 cbc.pos = 0; 146 cbc.pos = 0;
137 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, 147 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag,
138 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); 148 port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
139 if (d == NULL) 149 if (d == NULL)
140 return 1; 150 return 1;
151 if (0 == port)
152 {
153 const union MHD_DaemonInfo *dinfo;
154 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
155 if (NULL == dinfo || 0 == dinfo->port)
156 { MHD_stop_daemon (d); return 32; }
157 port = (int)dinfo->port;
158 }
141 c = curl_easy_init (); 159 c = curl_easy_init ();
142 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11080/hello_world?a=b&c=&d"); 160 curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world?a=b&c=&d");
161 curl_easy_setopt (c, CURLOPT_PORT, (long)port);
143 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 162 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
144 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 163 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
145 curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); 164 curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);