aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/daemontest_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/daemontest_get.c')
-rw-r--r--src/daemon/daemontest_get.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/daemon/daemontest_get.c b/src/daemon/daemontest_get.c
index c6c63fd8..1a6ca12a 100644
--- a/src/daemon/daemontest_get.c
+++ b/src/daemon/daemontest_get.c
@@ -66,16 +66,24 @@ ahc_echo (void *cls,
66 const char *upload_data, unsigned int *upload_data_size, 66 const char *upload_data, unsigned int *upload_data_size,
67 void **unused) 67 void **unused)
68{ 68{
69 static int ptr;
69 const char *me = cls; 70 const char *me = cls;
70 struct MHD_Response *response; 71 struct MHD_Response *response;
71 int ret; 72 int ret;
72 73
73 if (0 != strcmp (me, method)) 74 if (0 != strcmp (me, method))
74 return MHD_NO; /* unexpected method */ 75 return MHD_NO; /* unexpected method */
76 if (&ptr != *unused) {
77 *unused = &ptr;
78 return MHD_YES;
79 }
80 *unused = NULL;
75 response = MHD_create_response_from_data (strlen (url), 81 response = MHD_create_response_from_data (strlen (url),
76 (void *) url, MHD_NO, MHD_YES); 82 (void *) url, MHD_NO, MHD_YES);
77 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 83 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
78 MHD_destroy_response (response); 84 MHD_destroy_response (response);
85 if (ret == MHD_NO)
86 abort();
79 return ret; 87 return ret;
80} 88}
81 89
@@ -93,11 +101,11 @@ testInternalGet ()
93 cbc.size = 2048; 101 cbc.size = 2048;
94 cbc.pos = 0; 102 cbc.pos = 0;
95 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 103 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
96 1080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); 104 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
97 if (d == NULL) 105 if (d == NULL)
98 return 1; 106 return 1;
99 c = curl_easy_init (); 107 c = curl_easy_init ();
100 curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); 108 curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11080/hello_world");
101 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 109 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
102 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 110 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
103 curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); 111 curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
@@ -150,12 +158,12 @@ testMultithreadedGet ()
150 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 158 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
151 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 159 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
152 curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); 160 curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
153 curl_easy_setopt (c, CURLOPT_TIMEOUT, 2L); 161 curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
154 if (oneone) 162 if (oneone)
155 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 163 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
156 else 164 else
157 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); 165 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
158 curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 2L); 166 curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L);
159 // NOTE: use of CONNECTTIMEOUT without also 167 // NOTE: use of CONNECTTIMEOUT without also
160 // setting NOSIGNAL results in really weird 168 // setting NOSIGNAL results in really weird
161 // crashes on my system! 169 // crashes on my system!
@@ -214,8 +222,8 @@ testExternalGet ()
214 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 222 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
215 else 223 else
216 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); 224 curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
217 curl_easy_setopt (c, CURLOPT_TIMEOUT, 5L); 225 curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
218 curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 5L); 226 curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L);
219 // NOTE: use of CONNECTTIMEOUT without also 227 // NOTE: use of CONNECTTIMEOUT without also
220 // setting NOSIGNAL results in really weird 228 // setting NOSIGNAL results in really weird
221 // crashes on my system! 229 // crashes on my system!