diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-01-18 15:17:21 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-01-18 15:18:40 +0300 |
commit | bd41946e8f4f2086f7b2fcacc468a668c0676aff (patch) | |
tree | 151e103d07dc210f8365bbef0c26361d29873850 | |
parent | 17c22c2c3b8e2b56874ff701be58e7c10d1d41f4 (diff) | |
download | libmicrohttpd-bd41946e8f4f2086f7b2fcacc468a668c0676aff.tar.gz libmicrohttpd-bd41946e8f4f2086f7b2fcacc468a668c0676aff.zip |
Renamed 'con_cls' -> 'req_cls' for access handler callback
The argument is actually request-specific, not connection specific. The
name was confusing.
Fixed related documentation and clarified usage.
Also fixed code where argument named 'unused' was actually used.
105 files changed, 507 insertions, 510 deletions
diff --git a/doc/chapters/basicauthentication.inc b/doc/chapters/basicauthentication.inc index ca48403a..7aa33637 100644 --- a/doc/chapters/basicauthentication.inc +++ b/doc/chapters/basicauthentication.inc | |||
@@ -64,10 +64,10 @@ application should suspend the connection). | |||
64 | @end enumerate | 64 | @end enumerate |
65 | 65 | ||
66 | But how can we tell whether the callback has been called before for the | 66 | But how can we tell whether the callback has been called before for the |
67 | particular connection? Initially, the pointer this parameter references is | 67 | particular request? Initially, the pointer this parameter references is |
68 | set by @emph{MHD} in the callback. But it will also be "remembered" on the | 68 | set by @emph{MHD} in the callback. But it will also be "remembered" on the |
69 | next call (for the same connection). Thus, we can use the @code{con_cls} | 69 | next call (for the same request). Thus, we can use the @code{req_cls} |
70 | location to keep track of the connection state. For now, we will simply | 70 | location to keep track of the request state. For now, we will simply |
71 | generate no response until the parameter is non-null---implying the callback | 71 | generate no response until the parameter is non-null---implying the callback |
72 | was called before at least once. We do not need to share information between | 72 | was called before at least once. We do not need to share information between |
73 | different calls of the callback, so we can set the parameter to any address | 73 | different calls of the callback, so we can set the parameter to any address |
@@ -81,10 +81,10 @@ static int | |||
81 | answer_to_connection (void *cls, struct MHD_Connection *connection, | 81 | answer_to_connection (void *cls, struct MHD_Connection *connection, |
82 | const char *url, const char *method, const char *version, | 82 | const char *url, const char *method, const char *version, |
83 | const char *upload_data, size_t *upload_data_size, | 83 | const char *upload_data, size_t *upload_data_size, |
84 | void **con_cls) | 84 | void **req_cls) |
85 | { | 85 | { |
86 | if (0 != strcmp(method, "GET")) return MHD_NO; | 86 | if (0 != strcmp(method, "GET")) return MHD_NO; |
87 | if (NULL == *con_cls) {*con_cls = connection; return MHD_YES;} | 87 | if (NULL == *req_cls) {*req_cls = connection; return MHD_YES;} |
88 | 88 | ||
89 | ... | 89 | ... |
90 | /* else respond accordingly */ | 90 | /* else respond accordingly */ |
@@ -116,7 +116,7 @@ static int | |||
116 | answer_to_connection (void *cls, struct MHD_Connection *connection, | 116 | answer_to_connection (void *cls, struct MHD_Connection *connection, |
117 | const char *url, const char *method, | 117 | const char *url, const char *method, |
118 | const char *version, const char *upload_data, | 118 | const char *version, const char *upload_data, |
119 | size_t *upload_data_size, void **con_cls) | 119 | size_t *upload_data_size, void **req_cls) |
120 | { | 120 | { |
121 | char *user; | 121 | char *user; |
122 | char *pass; | 122 | char *pass; |
@@ -126,9 +126,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
126 | 126 | ||
127 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) | 127 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) |
128 | return MHD_NO; | 128 | return MHD_NO; |
129 | if (NULL == *con_cls) | 129 | if (NULL == *req_cls) |
130 | { | 130 | { |
131 | *con_cls = connection; | 131 | *req_cls = connection; |
132 | return MHD_YES; | 132 | return MHD_YES; |
133 | } | 133 | } |
134 | pass = NULL; | 134 | pass = NULL; |
diff --git a/doc/chapters/exploringrequests.inc b/doc/chapters/exploringrequests.inc index 2e43c38a..8237c9bb 100644 --- a/doc/chapters/exploringrequests.inc +++ b/doc/chapters/exploringrequests.inc | |||
@@ -14,7 +14,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
14 | const char *url, | 14 | const char *url, |
15 | const char *method, const char *version, | 15 | const char *method, const char *version, |
16 | const char *upload_data, | 16 | const char *upload_data, |
17 | size_t *upload_data_size, void **con_cls) | 17 | size_t *upload_data_size, void **req_cls) |
18 | { | 18 | { |
19 | ... | 19 | ... |
20 | return MHD_NO; | 20 | return MHD_NO; |
diff --git a/doc/chapters/hellobrowser.inc b/doc/chapters/hellobrowser.inc index ac7a5fe1..6ca37df9 100644 --- a/doc/chapters/hellobrowser.inc +++ b/doc/chapters/hellobrowser.inc | |||
@@ -43,7 +43,7 @@ int answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
43 | const char *url, | 43 | const char *url, |
44 | const char *method, const char *version, | 44 | const char *method, const char *version, |
45 | const char *upload_data, | 45 | const char *upload_data, |
46 | size_t *upload_data_size, void **con_cls) | 46 | size_t *upload_data_size, void **req_cls) |
47 | { | 47 | { |
48 | const char *page = "<html><body>Hello, browser!</body></html>"; | 48 | const char *page = "<html><body>Hello, browser!</body></html>"; |
49 | 49 | ||
diff --git a/doc/chapters/largerpost.inc b/doc/chapters/largerpost.inc index 11479382..681550ce 100644 --- a/doc/chapters/largerpost.inc +++ b/doc/chapters/largerpost.inc | |||
@@ -95,9 +95,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
95 | const char *url, | 95 | const char *url, |
96 | const char *method, const char *version, | 96 | const char *method, const char *version, |
97 | const char *upload_data, | 97 | const char *upload_data, |
98 | size_t *upload_data_size, void **con_cls) | 98 | size_t *upload_data_size, void **req_cls) |
99 | { | 99 | { |
100 | if (NULL == *con_cls) | 100 | if (NULL == *req_cls) |
101 | { | 101 | { |
102 | struct connection_info_struct *con_info; | 102 | struct connection_info_struct *con_info; |
103 | 103 | ||
@@ -120,7 +120,7 @@ the addition of a filepointer for each connection. | |||
120 | } | 120 | } |
121 | else con_info->connectiontype = GET; | 121 | else con_info->connectiontype = GET; |
122 | 122 | ||
123 | *con_cls = (void*) con_info; | 123 | *req_cls = (void*) con_info; |
124 | 124 | ||
125 | return MHD_YES; | 125 | return MHD_YES; |
126 | } | 126 | } |
@@ -179,7 +179,7 @@ constituted no expected request method. | |||
179 | @verbatim | 179 | @verbatim |
180 | if (0 == strcmp (method, "POST")) | 180 | if (0 == strcmp (method, "POST")) |
181 | { | 181 | { |
182 | struct connection_info_struct *con_info = *con_cls; | 182 | struct connection_info_struct *con_info = *req_cls; |
183 | 183 | ||
184 | if (0 != *upload_data_size) | 184 | if (0 != *upload_data_size) |
185 | { | 185 | { |
@@ -284,10 +284,10 @@ The new client was registered when the postprocessor was created. Likewise, we u | |||
284 | on destroying the postprocessor when the request is completed. | 284 | on destroying the postprocessor when the request is completed. |
285 | @verbatim | 285 | @verbatim |
286 | void request_completed (void *cls, struct MHD_Connection *connection, | 286 | void request_completed (void *cls, struct MHD_Connection *connection, |
287 | void **con_cls, | 287 | void **req_cls, |
288 | enum MHD_RequestTerminationCode toe) | 288 | enum MHD_RequestTerminationCode toe) |
289 | { | 289 | { |
290 | struct connection_info_struct *con_info = *con_cls; | 290 | struct connection_info_struct *con_info = *req_cls; |
291 | 291 | ||
292 | if (NULL == con_info) return; | 292 | if (NULL == con_info) return; |
293 | 293 | ||
@@ -303,7 +303,7 @@ void request_completed (void *cls, struct MHD_Connection *connection, | |||
303 | } | 303 | } |
304 | 304 | ||
305 | free (con_info); | 305 | free (con_info); |
306 | *con_cls = NULL; | 306 | *req_cls = NULL; |
307 | } | 307 | } |
308 | @end verbatim | 308 | @end verbatim |
309 | @noindent | 309 | @noindent |
diff --git a/doc/chapters/processingpost.inc b/doc/chapters/processingpost.inc index 920dac31..8f0dc7d8 100644 --- a/doc/chapters/processingpost.inc +++ b/doc/chapters/processingpost.inc | |||
@@ -111,10 +111,10 @@ requests other than @emph{POST} requests. | |||
111 | 111 | ||
112 | @verbatim | 112 | @verbatim |
113 | void request_completed (void *cls, struct MHD_Connection *connection, | 113 | void request_completed (void *cls, struct MHD_Connection *connection, |
114 | void **con_cls, | 114 | void **req_cls, |
115 | enum MHD_RequestTerminationCode toe) | 115 | enum MHD_RequestTerminationCode toe) |
116 | { | 116 | { |
117 | struct connection_info_struct *con_info = *con_cls; | 117 | struct connection_info_struct *con_info = *req_cls; |
118 | 118 | ||
119 | if (NULL == con_info) return; | 119 | if (NULL == con_info) return; |
120 | if (con_info->connectiontype == POST) | 120 | if (con_info->connectiontype == POST) |
@@ -124,7 +124,7 @@ void request_completed (void *cls, struct MHD_Connection *connection, | |||
124 | } | 124 | } |
125 | 125 | ||
126 | free (con_info); | 126 | free (con_info); |
127 | *con_cls = NULL; | 127 | *req_cls = NULL; |
128 | } | 128 | } |
129 | @end verbatim | 129 | @end verbatim |
130 | @noindent | 130 | @noindent |
@@ -155,9 +155,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
155 | const char *url, | 155 | const char *url, |
156 | const char *method, const char *version, | 156 | const char *method, const char *version, |
157 | const char *upload_data, | 157 | const char *upload_data, |
158 | size_t *upload_data_size, void **con_cls) | 158 | size_t *upload_data_size, void **req_cls) |
159 | { | 159 | { |
160 | if(NULL == *con_cls) | 160 | if(NULL == *req_cls) |
161 | { | 161 | { |
162 | struct connection_info_struct *con_info; | 162 | struct connection_info_struct *con_info; |
163 | 163 | ||
@@ -190,7 +190,7 @@ of the request is stored for convenience. | |||
190 | The address of our structure will both serve as the indicator for successive iterations and to remember | 190 | The address of our structure will both serve as the indicator for successive iterations and to remember |
191 | the particular details about the connection. | 191 | the particular details about the connection. |
192 | @verbatim | 192 | @verbatim |
193 | *con_cls = (void*) con_info; | 193 | *req_cls = (void*) con_info; |
194 | return MHD_YES; | 194 | return MHD_YES; |
195 | } | 195 | } |
196 | @end verbatim | 196 | @end verbatim |
@@ -212,7 +212,7 @@ considered---all of it. | |||
212 | @verbatim | 212 | @verbatim |
213 | if (0 == strcmp (method, "POST")) | 213 | if (0 == strcmp (method, "POST")) |
214 | { | 214 | { |
215 | struct connection_info_struct *con_info = *con_cls; | 215 | struct connection_info_struct *con_info = *req_cls; |
216 | 216 | ||
217 | if (*upload_data_size != 0) | 217 | if (*upload_data_size != 0) |
218 | { | 218 | { |
diff --git a/doc/chapters/responseheaders.inc b/doc/chapters/responseheaders.inc index 0b1c67e2..cd33e257 100644 --- a/doc/chapters/responseheaders.inc +++ b/doc/chapters/responseheaders.inc | |||
@@ -28,7 +28,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
28 | const char *url, | 28 | const char *url, |
29 | const char *method, const char *version, | 29 | const char *method, const char *version, |
30 | const char *upload_data, | 30 | const char *upload_data, |
31 | size_t *upload_data_size, void **con_cls) | 31 | size_t *upload_data_size, void **req_cls) |
32 | { | 32 | { |
33 | unsigned char *buffer = NULL; | 33 | unsigned char *buffer = NULL; |
34 | struct MHD_Response *response; | 34 | struct MHD_Response *response; |
diff --git a/doc/chapters/websocket.inc b/doc/chapters/websocket.inc index a480fd13..e1cbdc2b 100644 --- a/doc/chapters/websocket.inc +++ b/doc/chapters/websocket.inc | |||
@@ -122,7 +122,7 @@ per connection, could look like this: | |||
122 | static void | 122 | static void |
123 | upgrade_handler (void *cls, | 123 | upgrade_handler (void *cls, |
124 | struct MHD_Connection *connection, | 124 | struct MHD_Connection *connection, |
125 | void *con_cls, | 125 | void *req_cls, |
126 | const char *extra_in, | 126 | const char *extra_in, |
127 | size_t extra_in_size, | 127 | size_t extra_in_size, |
128 | MHD_socket fd, | 128 | MHD_socket fd, |
@@ -501,7 +501,7 @@ callback function from an earlier example to a working websocket: | |||
501 | static void | 501 | static void |
502 | upgrade_handler (void *cls, | 502 | upgrade_handler (void *cls, |
503 | struct MHD_Connection *connection, | 503 | struct MHD_Connection *connection, |
504 | void *con_cls, | 504 | void *req_cls, |
505 | const char *extra_in, | 505 | const char *extra_in, |
506 | size_t extra_in_size, | 506 | size_t extra_in_size, |
507 | MHD_socket fd, | 507 | MHD_socket fd, |
diff --git a/doc/examples/basicauthentication.c b/doc/examples/basicauthentication.c index fffc728f..3b105a1d 100644 --- a/doc/examples/basicauthentication.c +++ b/doc/examples/basicauthentication.c | |||
@@ -21,7 +21,7 @@ static enum MHD_Result | |||
21 | answer_to_connection (void *cls, struct MHD_Connection *connection, | 21 | answer_to_connection (void *cls, struct MHD_Connection *connection, |
22 | const char *url, const char *method, | 22 | const char *url, const char *method, |
23 | const char *version, const char *upload_data, | 23 | const char *version, const char *upload_data, |
24 | size_t *upload_data_size, void **con_cls) | 24 | size_t *upload_data_size, void **req_cls) |
25 | { | 25 | { |
26 | char *user; | 26 | char *user; |
27 | char *pass; | 27 | char *pass; |
@@ -36,9 +36,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
36 | 36 | ||
37 | if (0 != strcmp (method, "GET")) | 37 | if (0 != strcmp (method, "GET")) |
38 | return MHD_NO; | 38 | return MHD_NO; |
39 | if (NULL == *con_cls) | 39 | if (NULL == *req_cls) |
40 | { | 40 | { |
41 | *con_cls = connection; | 41 | *req_cls = connection; |
42 | return MHD_YES; | 42 | return MHD_YES; |
43 | } | 43 | } |
44 | pass = NULL; | 44 | pass = NULL; |
diff --git a/doc/examples/hellobrowser.c b/doc/examples/hellobrowser.c index 0c13c24d..b14ea6d8 100644 --- a/doc/examples/hellobrowser.c +++ b/doc/examples/hellobrowser.c | |||
@@ -18,7 +18,7 @@ static enum MHD_Result | |||
18 | answer_to_connection (void *cls, struct MHD_Connection *connection, | 18 | answer_to_connection (void *cls, struct MHD_Connection *connection, |
19 | const char *url, const char *method, | 19 | const char *url, const char *method, |
20 | const char *version, const char *upload_data, | 20 | const char *version, const char *upload_data, |
21 | size_t *upload_data_size, void **con_cls) | 21 | size_t *upload_data_size, void **req_cls) |
22 | { | 22 | { |
23 | const char *page = "<html><body>Hello, browser!</body></html>"; | 23 | const char *page = "<html><body>Hello, browser!</body></html>"; |
24 | struct MHD_Response *response; | 24 | struct MHD_Response *response; |
@@ -29,7 +29,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
29 | (void) version; /* Unused. Silent compiler warning. */ | 29 | (void) version; /* Unused. Silent compiler warning. */ |
30 | (void) upload_data; /* Unused. Silent compiler warning. */ | 30 | (void) upload_data; /* Unused. Silent compiler warning. */ |
31 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 31 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
32 | (void) con_cls; /* Unused. Silent compiler warning. */ | 32 | (void) req_cls; /* Unused. Silent compiler warning. */ |
33 | 33 | ||
34 | response = | 34 | response = |
35 | MHD_create_response_from_buffer (strlen (page), (void *) page, | 35 | MHD_create_response_from_buffer (strlen (page), (void *) page, |
diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c index dc685745..58649508 100644 --- a/doc/examples/largepost.c +++ b/doc/examples/largepost.c | |||
@@ -181,10 +181,10 @@ iterate_post (void *coninfo_cls, | |||
181 | static void | 181 | static void |
182 | request_completed (void *cls, | 182 | request_completed (void *cls, |
183 | struct MHD_Connection *connection, | 183 | struct MHD_Connection *connection, |
184 | void **con_cls, | 184 | void **req_cls, |
185 | enum MHD_RequestTerminationCode toe) | 185 | enum MHD_RequestTerminationCode toe) |
186 | { | 186 | { |
187 | struct connection_info_struct *con_info = *con_cls; | 187 | struct connection_info_struct *con_info = *req_cls; |
188 | (void) cls; /* Unused. Silent compiler warning. */ | 188 | (void) cls; /* Unused. Silent compiler warning. */ |
189 | (void) connection; /* Unused. Silent compiler warning. */ | 189 | (void) connection; /* Unused. Silent compiler warning. */ |
190 | (void) toe; /* Unused. Silent compiler warning. */ | 190 | (void) toe; /* Unused. Silent compiler warning. */ |
@@ -205,7 +205,7 @@ request_completed (void *cls, | |||
205 | } | 205 | } |
206 | 206 | ||
207 | free (con_info); | 207 | free (con_info); |
208 | *con_cls = NULL; | 208 | *req_cls = NULL; |
209 | } | 209 | } |
210 | 210 | ||
211 | 211 | ||
@@ -217,13 +217,13 @@ answer_to_connection (void *cls, | |||
217 | const char *version, | 217 | const char *version, |
218 | const char *upload_data, | 218 | const char *upload_data, |
219 | size_t *upload_data_size, | 219 | size_t *upload_data_size, |
220 | void **con_cls) | 220 | void **req_cls) |
221 | { | 221 | { |
222 | (void) cls; /* Unused. Silent compiler warning. */ | 222 | (void) cls; /* Unused. Silent compiler warning. */ |
223 | (void) url; /* Unused. Silent compiler warning. */ | 223 | (void) url; /* Unused. Silent compiler warning. */ |
224 | (void) version; /* Unused. Silent compiler warning. */ | 224 | (void) version; /* Unused. Silent compiler warning. */ |
225 | 225 | ||
226 | if (NULL == *con_cls) | 226 | if (NULL == *req_cls) |
227 | { | 227 | { |
228 | /* First call, setup data structures */ | 228 | /* First call, setup data structures */ |
229 | struct connection_info_struct *con_info; | 229 | struct connection_info_struct *con_info; |
@@ -262,7 +262,7 @@ answer_to_connection (void *cls, | |||
262 | con_info->connectiontype = GET; | 262 | con_info->connectiontype = GET; |
263 | } | 263 | } |
264 | 264 | ||
265 | *con_cls = (void *) con_info; | 265 | *req_cls = (void *) con_info; |
266 | 266 | ||
267 | return MHD_YES; | 267 | return MHD_YES; |
268 | } | 268 | } |
@@ -283,7 +283,7 @@ answer_to_connection (void *cls, | |||
283 | 283 | ||
284 | if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) | 284 | if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) |
285 | { | 285 | { |
286 | struct connection_info_struct *con_info = *con_cls; | 286 | struct connection_info_struct *con_info = *req_cls; |
287 | 287 | ||
288 | if (0 != *upload_data_size) | 288 | if (0 != *upload_data_size) |
289 | { | 289 | { |
diff --git a/doc/examples/logging.c b/doc/examples/logging.c index 22ff7e62..0db2e2ef 100644 --- a/doc/examples/logging.c +++ b/doc/examples/logging.c | |||
@@ -29,13 +29,13 @@ static enum MHD_Result | |||
29 | answer_to_connection (void *cls, struct MHD_Connection *connection, | 29 | answer_to_connection (void *cls, struct MHD_Connection *connection, |
30 | const char *url, const char *method, | 30 | const char *url, const char *method, |
31 | const char *version, const char *upload_data, | 31 | const char *version, const char *upload_data, |
32 | size_t *upload_data_size, void **con_cls) | 32 | size_t *upload_data_size, void **req_cls) |
33 | { | 33 | { |
34 | (void) cls; /* Unused. Silent compiler warning. */ | 34 | (void) cls; /* Unused. Silent compiler warning. */ |
35 | (void) version; /* Unused. Silent compiler warning. */ | 35 | (void) version; /* Unused. Silent compiler warning. */ |
36 | (void) upload_data; /* Unused. Silent compiler warning. */ | 36 | (void) upload_data; /* Unused. Silent compiler warning. */ |
37 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 37 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
38 | (void) con_cls; /* Unused. Silent compiler warning. */ | 38 | (void) req_cls; /* Unused. Silent compiler warning. */ |
39 | printf ("New %s request for %s using version %s\n", method, url, version); | 39 | printf ("New %s request for %s using version %s\n", method, url, version); |
40 | 40 | ||
41 | MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key, | 41 | MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key, |
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c index f1cf939c..80eebbe9 100644 --- a/doc/examples/responseheaders.c +++ b/doc/examples/responseheaders.c | |||
@@ -23,7 +23,7 @@ static enum MHD_Result | |||
23 | answer_to_connection (void *cls, struct MHD_Connection *connection, | 23 | answer_to_connection (void *cls, struct MHD_Connection *connection, |
24 | const char *url, const char *method, | 24 | const char *url, const char *method, |
25 | const char *version, const char *upload_data, | 25 | const char *version, const char *upload_data, |
26 | size_t *upload_data_size, void **con_cls) | 26 | size_t *upload_data_size, void **req_cls) |
27 | { | 27 | { |
28 | struct MHD_Response *response; | 28 | struct MHD_Response *response; |
29 | int fd; | 29 | int fd; |
@@ -34,7 +34,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
34 | (void) version; /* Unused. Silent compiler warning. */ | 34 | (void) version; /* Unused. Silent compiler warning. */ |
35 | (void) upload_data; /* Unused. Silent compiler warning. */ | 35 | (void) upload_data; /* Unused. Silent compiler warning. */ |
36 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 36 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
37 | (void) con_cls; /* Unused. Silent compiler warning. */ | 37 | (void) req_cls; /* Unused. Silent compiler warning. */ |
38 | 38 | ||
39 | if (0 != strcmp (method, "GET")) | 39 | if (0 != strcmp (method, "GET")) |
40 | return MHD_NO; | 40 | return MHD_NO; |
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c index db311bd4..5dd74e2c 100644 --- a/doc/examples/sessions.c +++ b/doc/examples/sessions.c | |||
@@ -548,7 +548,7 @@ post_iterator (void *cls, | |||
548 | * @param upload_data_size set initially to the size of the | 548 | * @param upload_data_size set initially to the size of the |
549 | * upload_data provided; the method must update this | 549 | * upload_data provided; the method must update this |
550 | * value to the number of bytes NOT processed; | 550 | * value to the number of bytes NOT processed; |
551 | * @param ptr pointer that the callback can set to some | 551 | * @param req_cls pointer that the callback can set to some |
552 | * address and that will be preserved by MHD for future | 552 | * address and that will be preserved by MHD for future |
553 | * calls for this request; since the access handler may | 553 | * calls for this request; since the access handler may |
554 | * be called many times (i.e., for a PUT/POST operation | 554 | * be called many times (i.e., for a PUT/POST operation |
@@ -557,7 +557,7 @@ post_iterator (void *cls, | |||
557 | * If necessary, this state can be cleaned up in the | 557 | * If necessary, this state can be cleaned up in the |
558 | * global "MHD_RequestCompleted" callback (which | 558 | * global "MHD_RequestCompleted" callback (which |
559 | * can be set with the MHD_OPTION_NOTIFY_COMPLETED). | 559 | * can be set with the MHD_OPTION_NOTIFY_COMPLETED). |
560 | * Initially, <tt>*con_cls</tt> will be NULL. | 560 | * Initially, <tt>*req_cls</tt> will be NULL. |
561 | * @return MHS_YES if the connection was handled successfully, | 561 | * @return MHS_YES if the connection was handled successfully, |
562 | * MHS_NO if the socket must be closed due to a serious | 562 | * MHS_NO if the socket must be closed due to a serious |
563 | * error while handling the request | 563 | * error while handling the request |
@@ -570,7 +570,7 @@ create_response (void *cls, | |||
570 | const char *version, | 570 | const char *version, |
571 | const char *upload_data, | 571 | const char *upload_data, |
572 | size_t *upload_data_size, | 572 | size_t *upload_data_size, |
573 | void **ptr) | 573 | void **req_cls) |
574 | { | 574 | { |
575 | struct MHD_Response *response; | 575 | struct MHD_Response *response; |
576 | struct Request *request; | 576 | struct Request *request; |
@@ -580,7 +580,7 @@ create_response (void *cls, | |||
580 | (void) cls; /* Unused. Silent compiler warning. */ | 580 | (void) cls; /* Unused. Silent compiler warning. */ |
581 | (void) version; /* Unused. Silent compiler warning. */ | 581 | (void) version; /* Unused. Silent compiler warning. */ |
582 | 582 | ||
583 | request = *ptr; | 583 | request = *req_cls; |
584 | if (NULL == request) | 584 | if (NULL == request) |
585 | { | 585 | { |
586 | request = calloc (1, sizeof (struct Request)); | 586 | request = calloc (1, sizeof (struct Request)); |
@@ -589,7 +589,7 @@ create_response (void *cls, | |||
589 | fprintf (stderr, "calloc error: %s\n", strerror (errno)); | 589 | fprintf (stderr, "calloc error: %s\n", strerror (errno)); |
590 | return MHD_NO; | 590 | return MHD_NO; |
591 | } | 591 | } |
592 | *ptr = request; | 592 | *req_cls = request; |
593 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) | 593 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) |
594 | { | 594 | { |
595 | request->pp = MHD_create_post_processor (connection, 1024, | 595 | request->pp = MHD_create_post_processor (connection, 1024, |
@@ -668,16 +668,16 @@ create_response (void *cls, | |||
668 | * | 668 | * |
669 | * @param cls not used | 669 | * @param cls not used |
670 | * @param connection connection that completed | 670 | * @param connection connection that completed |
671 | * @param con_cls session handle | 671 | * @param req_cls session handle |
672 | * @param toe status code | 672 | * @param toe status code |
673 | */ | 673 | */ |
674 | static void | 674 | static void |
675 | request_completed_callback (void *cls, | 675 | request_completed_callback (void *cls, |
676 | struct MHD_Connection *connection, | 676 | struct MHD_Connection *connection, |
677 | void **con_cls, | 677 | void **req_cls, |
678 | enum MHD_RequestTerminationCode toe) | 678 | enum MHD_RequestTerminationCode toe) |
679 | { | 679 | { |
680 | struct Request *request = *con_cls; | 680 | struct Request *request = *req_cls; |
681 | (void) cls; /* Unused. Silent compiler warning. */ | 681 | (void) cls; /* Unused. Silent compiler warning. */ |
682 | (void) connection; /* Unused. Silent compiler warning. */ | 682 | (void) connection; /* Unused. Silent compiler warning. */ |
683 | (void) toe; /* Unused. Silent compiler warning. */ | 683 | (void) toe; /* Unused. Silent compiler warning. */ |
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c index 1e52e5dd..ea3899d1 100644 --- a/doc/examples/simplepost.c +++ b/doc/examples/simplepost.c | |||
@@ -105,9 +105,9 @@ iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, | |||
105 | 105 | ||
106 | static void | 106 | static void |
107 | request_completed (void *cls, struct MHD_Connection *connection, | 107 | request_completed (void *cls, struct MHD_Connection *connection, |
108 | void **con_cls, enum MHD_RequestTerminationCode toe) | 108 | void **req_cls, enum MHD_RequestTerminationCode toe) |
109 | { | 109 | { |
110 | struct connection_info_struct *con_info = *con_cls; | 110 | struct connection_info_struct *con_info = *req_cls; |
111 | (void) cls; /* Unused. Silent compiler warning. */ | 111 | (void) cls; /* Unused. Silent compiler warning. */ |
112 | (void) connection; /* Unused. Silent compiler warning. */ | 112 | (void) connection; /* Unused. Silent compiler warning. */ |
113 | (void) toe; /* Unused. Silent compiler warning. */ | 113 | (void) toe; /* Unused. Silent compiler warning. */ |
@@ -123,7 +123,7 @@ request_completed (void *cls, struct MHD_Connection *connection, | |||
123 | } | 123 | } |
124 | 124 | ||
125 | free (con_info); | 125 | free (con_info); |
126 | *con_cls = NULL; | 126 | *req_cls = NULL; |
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
@@ -131,13 +131,13 @@ static enum MHD_Result | |||
131 | answer_to_connection (void *cls, struct MHD_Connection *connection, | 131 | answer_to_connection (void *cls, struct MHD_Connection *connection, |
132 | const char *url, const char *method, | 132 | const char *url, const char *method, |
133 | const char *version, const char *upload_data, | 133 | const char *version, const char *upload_data, |
134 | size_t *upload_data_size, void **con_cls) | 134 | size_t *upload_data_size, void **req_cls) |
135 | { | 135 | { |
136 | (void) cls; /* Unused. Silent compiler warning. */ | 136 | (void) cls; /* Unused. Silent compiler warning. */ |
137 | (void) url; /* Unused. Silent compiler warning. */ | 137 | (void) url; /* Unused. Silent compiler warning. */ |
138 | (void) version; /* Unused. Silent compiler warning. */ | 138 | (void) version; /* Unused. Silent compiler warning. */ |
139 | 139 | ||
140 | if (NULL == *con_cls) | 140 | if (NULL == *req_cls) |
141 | { | 141 | { |
142 | struct connection_info_struct *con_info; | 142 | struct connection_info_struct *con_info; |
143 | 143 | ||
@@ -163,7 +163,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
163 | else | 163 | else |
164 | con_info->connectiontype = GET; | 164 | con_info->connectiontype = GET; |
165 | 165 | ||
166 | *con_cls = (void *) con_info; | 166 | *req_cls = (void *) con_info; |
167 | 167 | ||
168 | return MHD_YES; | 168 | return MHD_YES; |
169 | } | 169 | } |
@@ -175,7 +175,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
175 | 175 | ||
176 | if (0 == strcmp (method, "POST")) | 176 | if (0 == strcmp (method, "POST")) |
177 | { | 177 | { |
178 | struct connection_info_struct *con_info = *con_cls; | 178 | struct connection_info_struct *con_info = *req_cls; |
179 | 179 | ||
180 | if (*upload_data_size != 0) | 180 | if (*upload_data_size != 0) |
181 | { | 181 | { |
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c index b31eab43..4db00b7f 100644 --- a/doc/examples/tlsauthentication.c +++ b/doc/examples/tlsauthentication.c | |||
@@ -225,7 +225,7 @@ static enum MHD_Result | |||
225 | answer_to_connection (void *cls, struct MHD_Connection *connection, | 225 | answer_to_connection (void *cls, struct MHD_Connection *connection, |
226 | const char *url, const char *method, | 226 | const char *url, const char *method, |
227 | const char *version, const char *upload_data, | 227 | const char *version, const char *upload_data, |
228 | size_t *upload_data_size, void **con_cls) | 228 | size_t *upload_data_size, void **req_cls) |
229 | { | 229 | { |
230 | (void) cls; /* Unused. Silent compiler warning. */ | 230 | (void) cls; /* Unused. Silent compiler warning. */ |
231 | (void) url; /* Unused. Silent compiler warning. */ | 231 | (void) url; /* Unused. Silent compiler warning. */ |
@@ -235,9 +235,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
235 | 235 | ||
236 | if (0 != strcmp (method, "GET")) | 236 | if (0 != strcmp (method, "GET")) |
237 | return MHD_NO; | 237 | return MHD_NO; |
238 | if (NULL == *con_cls) | 238 | if (NULL == *req_cls) |
239 | { | 239 | { |
240 | *con_cls = connection; | 240 | *req_cls = connection; |
241 | return MHD_YES; | 241 | return MHD_YES; |
242 | } | 242 | } |
243 | 243 | ||
diff --git a/doc/examples/websocket.c b/doc/examples/websocket.c index 4fa6f4ed..5cdf0423 100644 --- a/doc/examples/websocket.c +++ b/doc/examples/websocket.c | |||
@@ -80,7 +80,7 @@ make_blocking (MHD_socket fd); | |||
80 | static void | 80 | static void |
81 | upgrade_handler (void *cls, | 81 | upgrade_handler (void *cls, |
82 | struct MHD_Connection *connection, | 82 | struct MHD_Connection *connection, |
83 | void *con_cls, | 83 | void *req_cls, |
84 | const char *extra_in, | 84 | const char *extra_in, |
85 | size_t extra_in_size, | 85 | size_t extra_in_size, |
86 | MHD_socket fd, | 86 | MHD_socket fd, |
@@ -307,7 +307,7 @@ access_handler (void *cls, | |||
307 | const char *version, | 307 | const char *version, |
308 | const char *upload_data, | 308 | const char *upload_data, |
309 | size_t *upload_data_size, | 309 | size_t *upload_data_size, |
310 | void **ptr) | 310 | void **req_cls) |
311 | { | 311 | { |
312 | static int aptr; | 312 | static int aptr; |
313 | struct MHD_Response *response; | 313 | struct MHD_Response *response; |
@@ -319,13 +319,13 @@ access_handler (void *cls, | |||
319 | 319 | ||
320 | if (0 != strcmp (method, "GET")) | 320 | if (0 != strcmp (method, "GET")) |
321 | return MHD_NO; /* unexpected method */ | 321 | return MHD_NO; /* unexpected method */ |
322 | if (&aptr != *ptr) | 322 | if (&aptr != *req_cls) |
323 | { | 323 | { |
324 | /* do never respond on first call */ | 324 | /* do never respond on first call */ |
325 | *ptr = &aptr; | 325 | *req_cls = &aptr; |
326 | return MHD_YES; | 326 | return MHD_YES; |
327 | } | 327 | } |
328 | *ptr = NULL; /* reset when done */ | 328 | *req_cls = NULL; /* reset when done */ |
329 | 329 | ||
330 | if (0 == strcmp (url, "/")) | 330 | if (0 == strcmp (url, "/")) |
331 | { | 331 | { |
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi index a6bd12eb..a14c28d3 100644 --- a/doc/libmicrohttpd.texi +++ b/doc/libmicrohttpd.texi | |||
@@ -734,18 +734,15 @@ callback. The second pointer maybe @code{NULL}. | |||
734 | 734 | ||
735 | @item MHD_OPTION_NOTIFY_CONNECTION | 735 | @item MHD_OPTION_NOTIFY_CONNECTION |
736 | Register a function that should be called when the TCP connection to a | 736 | Register a function that should be called when the TCP connection to a |
737 | client is opened or closed. Note that | 737 | client is opened or closed. The registered callback is called twice per |
738 | @code{MHD_OPTION_NOTIFY_COMPLETED} and the @code{con_cls} argument to | 738 | TCP connection, with @code{MHD_CONNECTION_NOTIFY_STARTED} and |
739 | the @code{MHD_AccessHandlerCallback} are per HTTP request (and there | 739 | @code{MHD_CONNECTION_NOTIFY_CLOSED} respectively. An additional |
740 | can be multiple HTTP requests per TCP connection). The registered | ||
741 | callback is called twice per TCP connection, with | ||
742 | @code{MHD_CONNECTION_NOTIFY_STARTED} and | ||
743 | @code{MHD_CONNECTION_NOTIFY_CLOSED} respectively. An additional | ||
744 | argument can be used to store TCP connection specific information, | 740 | argument can be used to store TCP connection specific information, |
745 | which can be retrieved using @code{MHD_CONNECTION_INFO_SOCKET_CONTEXT} | 741 | which can be retrieved using @code{MHD_CONNECTION_INFO_SOCKET_CONTEXT} |
746 | during the lifetime of the TCP connection. The respective location is | 742 | during the lifetime of the TCP connection. |
747 | not the same as the HTTP-request-specific @code{con_cls} from the | 743 | Note @code{MHD_OPTION_NOTIFY_COMPLETED} and the @code{req_cls} argument |
748 | @code{MHD_AccessHandlerCallback}. | 744 | to the @code{MHD_AccessHandlerCallback} are per HTTP request (and there |
745 | can be multiple HTTP requests per TCP connection). | ||
749 | 746 | ||
750 | This option should be followed by @strong{TWO} pointers. First a | 747 | This option should be followed by @strong{TWO} pointers. First a |
751 | pointer to a function of type @code{MHD_NotifyConnectionCallback()} | 748 | pointer to a function of type @code{MHD_NotifyConnectionCallback()} |
@@ -820,12 +817,12 @@ one must be of the form | |||
820 | void * my_logger(void * cls, const char * uri, struct MHD_Connection *con) | 817 | void * my_logger(void * cls, const char * uri, struct MHD_Connection *con) |
821 | @end example | 818 | @end example |
822 | where the return value will be passed as | 819 | where the return value will be passed as |
823 | @code{*con_cls} in calls to the @code{MHD_AccessHandlerCallback} | 820 | @code{*req_cls} in calls to the @code{MHD_AccessHandlerCallback} |
824 | when this request is processed later; returning a | 821 | when this request is processed later; returning a |
825 | value of @code{NULL} has no special significance; (however, | 822 | value of @code{NULL} has no special significance; (however, |
826 | note that if you return non-@code{NULL}, you can no longer | 823 | note that if you return non-@code{NULL}, you can no longer |
827 | rely on the first call to the access handler having | 824 | rely on the first call to the access handler having |
828 | @code{NULL == *con_cls} on entry) | 825 | @code{NULL == *req_cls} on entry) |
829 | @code{cls} will be set to the second argument following | 826 | @code{cls} will be set to the second argument following |
830 | MHD_OPTION_URI_LOG_CALLBACK. Finally, @code{uri} will | 827 | MHD_OPTION_URI_LOG_CALLBACK. Finally, @code{uri} will |
831 | be the 0-terminated URI of the request. | 828 | be the 0-terminated URI of the request. |
@@ -1808,7 +1805,7 @@ length of the address information. | |||
1808 | @end deftypefn | 1805 | @end deftypefn |
1809 | 1806 | ||
1810 | 1807 | ||
1811 | @deftypefn {Function Pointer} enum MHD_Result {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) | 1808 | @deftypefn {Function Pointer} enum MHD_Result {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **req_cls) |
1812 | Invoked in the context of a connection to answer a request from the | 1809 | Invoked in the context of a connection to answer a request from the |
1813 | client. This callback must call MHD functions (example: the | 1810 | client. This callback must call MHD functions (example: the |
1814 | @code{MHD_Response} ones) to provide content to give back to the client | 1811 | @code{MHD_Response} ones) to provide content to give back to the client |
@@ -1874,7 +1871,7 @@ and return an internal server error to the client. In order to | |||
1874 | avoid this, clients must be able to process upload data incrementally | 1871 | avoid this, clients must be able to process upload data incrementally |
1875 | and reduce the value of @code{upload_data_size}. | 1872 | and reduce the value of @code{upload_data_size}. |
1876 | 1873 | ||
1877 | @item con_cls | 1874 | @item req_cls |
1878 | reference to a pointer, initially set to @code{NULL}, that this callback can | 1875 | reference to a pointer, initially set to @code{NULL}, that this callback can |
1879 | set to some address and that will be preserved by MHD for future | 1876 | set to some address and that will be preserved by MHD for future |
1880 | calls for this request; | 1877 | calls for this request; |
@@ -1890,7 +1887,7 @@ if necessary, this state can be cleaned up in the global | |||
1890 | @end deftypefn | 1887 | @end deftypefn |
1891 | 1888 | ||
1892 | 1889 | ||
1893 | @deftypefn {Function Pointer} void {*MHD_RequestCompletedCallback} (void *cls, struct MHD_Connectionconnection, void **con_cls, enum MHD_RequestTerminationCode toe) | 1890 | @deftypefn {Function Pointer} void {*MHD_RequestCompletedCallback} (void *cls, struct MHD_Connectionconnection, void **req_cls, enum MHD_RequestTerminationCode toe) |
1894 | Signature of the callback used by MHD to notify the application about | 1891 | Signature of the callback used by MHD to notify the application about |
1895 | completed requests. | 1892 | completed requests. |
1896 | 1893 | ||
@@ -1901,7 +1898,7 @@ custom value selected at callback registration time; | |||
1901 | @item connection | 1898 | @item connection |
1902 | connection handle; | 1899 | connection handle; |
1903 | 1900 | ||
1904 | @item con_cls | 1901 | @item req_cls |
1905 | value as set by the last call to the | 1902 | value as set by the last call to the |
1906 | @code{MHD_AccessHandlerCallback}; | 1903 | @code{MHD_AccessHandlerCallback}; |
1907 | 1904 | ||
@@ -2944,8 +2941,8 @@ matches the @code{upgrade_handler_cls} that was given to @code{MHD_create_respon | |||
2944 | @item connection | 2941 | @item connection |
2945 | identifies the connection that is being upgraded; | 2942 | identifies the connection that is being upgraded; |
2946 | 2943 | ||
2947 | @item con_cls | 2944 | @item req_cls |
2948 | last value left in `*con_cls` in the `MHD_AccessHandlerCallback` | 2945 | last value left in `*req_cls` in the `MHD_AccessHandlerCallback` |
2949 | 2946 | ||
2950 | @item extra_in | 2947 | @item extra_in |
2951 | buffer of bytes MHD read ``by accident'' from the socket already. This can happen if the client eagerly transmits more than just the HTTP request. The application should treat these as if it had read them from the socket. | 2948 | buffer of bytes MHD read ``by accident'' from the socket already. This can happen if the client eagerly transmits more than just the HTTP request. The application should treat these as if it had read them from the socket. |
@@ -3377,15 +3374,15 @@ process data as it arrives; at each invocation a new chunk of data must | |||
3377 | be processed. The arguments @var{upload_data} and @var{upload_data_size} | 3374 | be processed. The arguments @var{upload_data} and @var{upload_data_size} |
3378 | are used to reference the chunk of data. | 3375 | are used to reference the chunk of data. |
3379 | 3376 | ||
3380 | When @code{MHD_AccessHandlerCallback} is invoked for a new connection: | 3377 | When @code{MHD_AccessHandlerCallback} is invoked for a new request: |
3381 | its @code{*@var{con_cls}} argument is set to @code{NULL}. When @code{POST} | 3378 | its @code{*@var{req_cls}} argument is set to @code{NULL}. When @code{POST} |
3382 | data comes in the upload buffer it is @strong{mandatory} to use the | 3379 | data comes in the upload buffer it is @strong{mandatory} to use the |
3383 | @var{con_cls} to store a reference to per-connection data. The fact | 3380 | @var{req_cls} to store a reference to per-request data. The fact |
3384 | that the pointer was initially @code{NULL} can be used to detect that | 3381 | that the pointer was initially @code{NULL} can be used to detect that |
3385 | this is a new request. | 3382 | this is a new request. |
3386 | 3383 | ||
3387 | One method to detect that a new connection was established is | 3384 | One method to detect that a new request was started is |
3388 | to set @code{*con_cls} to an unused integer: | 3385 | to set @code{*req_cls} to an unused integer: |
3389 | 3386 | ||
3390 | @example | 3387 | @example |
3391 | int | 3388 | int |
@@ -3394,15 +3391,15 @@ access_handler (void *cls, | |||
3394 | const char *url, | 3391 | const char *url, |
3395 | const char *method, const char *version, | 3392 | const char *method, const char *version, |
3396 | const char *upload_data, size_t *upload_data_size, | 3393 | const char *upload_data, size_t *upload_data_size, |
3397 | void **con_cls) | 3394 | void **req_cls) |
3398 | @{ | 3395 | @{ |
3399 | static int old_connection_marker; | 3396 | static int old_connection_marker; |
3400 | int new_connection = (NULL == *con_cls); | 3397 | int new_connection = (NULL == *req_cls); |
3401 | 3398 | ||
3402 | if (new_connection) | 3399 | if (new_connection) |
3403 | @{ | 3400 | @{ |
3404 | /* new connection with POST */ | 3401 | /* new connection with POST */ |
3405 | *con_cls = &old_connection_marker; | 3402 | *req_cls = &old_connection_marker; |
3406 | @} | 3403 | @} |
3407 | 3404 | ||
3408 | ... | 3405 | ... |
@@ -3411,7 +3408,7 @@ access_handler (void *cls, | |||
3411 | 3408 | ||
3412 | @noindent | 3409 | @noindent |
3413 | In contrast to the previous example, for @code{POST} requests in particular, | 3410 | In contrast to the previous example, for @code{POST} requests in particular, |
3414 | it is more common to use the value of @code{*con_cls} to keep track of | 3411 | it is more common to use the value of @code{*req_cls} to keep track of |
3415 | actual state used during processing, such as the post processor (or a | 3412 | actual state used during processing, such as the post processor (or a |
3416 | struct containing a post processor): | 3413 | struct containing a post processor): |
3417 | 3414 | ||
@@ -3422,14 +3419,14 @@ access_handler (void *cls, | |||
3422 | const char *url, | 3419 | const char *url, |
3423 | const char *method, const char *version, | 3420 | const char *method, const char *version, |
3424 | const char *upload_data, size_t *upload_data_size, | 3421 | const char *upload_data, size_t *upload_data_size, |
3425 | void **con_cls) | 3422 | void **req_cls) |
3426 | @{ | 3423 | @{ |
3427 | struct MHD_PostProcessor * pp = *con_cls; | 3424 | struct MHD_PostProcessor * pp = *req_cls; |
3428 | 3425 | ||
3429 | if (pp == NULL) | 3426 | if (pp == NULL) |
3430 | @{ | 3427 | @{ |
3431 | pp = MHD_create_post_processor(connection, ...); | 3428 | pp = MHD_create_post_processor(connection, ...); |
3432 | *con_cls = pp; | 3429 | *req_cls = pp; |
3433 | return MHD_YES; | 3430 | return MHD_YES; |
3434 | @} | 3431 | @} |
3435 | if (*upload_data_size) | 3432 | if (*upload_data_size) |
@@ -3719,8 +3716,8 @@ Takes no extra arguments. | |||
3719 | Returns the client-specific pointer to a @code{void *} that was | 3716 | Returns the client-specific pointer to a @code{void *} that was |
3720 | (possibly) set during a @code{MHD_NotifyConnectionCallback} when the | 3717 | (possibly) set during a @code{MHD_NotifyConnectionCallback} when the |
3721 | socket was first accepted. Note that this is NOT the same as the | 3718 | socket was first accepted. Note that this is NOT the same as the |
3722 | @code{con_cls} argument of the @code{MHD_AccessHandlerCallback}. The | 3719 | @code{req_cls} argument of the @code{MHD_AccessHandlerCallback}. The |
3723 | @code{con_cls} is fresh for each HTTP request, while the | 3720 | @code{req_cls} is fresh for each HTTP request, while the |
3724 | @code{socket_context} is fresh for each socket. | 3721 | @code{socket_context} is fresh for each socket. |
3725 | 3722 | ||
3726 | Takes no extra arguments. | 3723 | Takes no extra arguments. |
diff --git a/src/examples/authorization_example.c b/src/examples/authorization_example.c index f9500325..e7a099ed 100644 --- a/src/examples/authorization_example.c +++ b/src/examples/authorization_example.c | |||
@@ -45,7 +45,7 @@ ahc_echo (void *cls, | |||
45 | const char *url, | 45 | const char *url, |
46 | const char *method, | 46 | const char *method, |
47 | const char *version, | 47 | const char *version, |
48 | const char *upload_data, size_t *upload_data_size, void **ptr) | 48 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
49 | { | 49 | { |
50 | static int aptr; | 50 | static int aptr; |
51 | const char *me = cls; | 51 | const char *me = cls; |
@@ -61,13 +61,13 @@ ahc_echo (void *cls, | |||
61 | 61 | ||
62 | if (0 != strcmp (method, "GET")) | 62 | if (0 != strcmp (method, "GET")) |
63 | return MHD_NO; /* unexpected method */ | 63 | return MHD_NO; /* unexpected method */ |
64 | if (&aptr != *ptr) | 64 | if (&aptr != *req_cls) |
65 | { | 65 | { |
66 | /* do never respond on first call */ | 66 | /* do never respond on first call */ |
67 | *ptr = &aptr; | 67 | *req_cls = &aptr; |
68 | return MHD_YES; | 68 | return MHD_YES; |
69 | } | 69 | } |
70 | *ptr = NULL; /* reset when done */ | 70 | *req_cls = NULL; /* reset when done */ |
71 | 71 | ||
72 | /* require: "Aladdin" with password "open sesame" */ | 72 | /* require: "Aladdin" with password "open sesame" */ |
73 | pass = NULL; | 73 | pass = NULL; |
diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c index a579d42b..185e3824 100644 --- a/src/examples/benchmark.c +++ b/src/examples/benchmark.c | |||
@@ -62,7 +62,7 @@ static struct MHD_Response *response; | |||
62 | * | 62 | * |
63 | * @param cls client-defined closure | 63 | * @param cls client-defined closure |
64 | * @param connection connection handle | 64 | * @param connection connection handle |
65 | * @param con_cls value as set by the last call to | 65 | * @param req_cls value as set by the last call to |
66 | * the MHD_AccessHandlerCallback | 66 | * the MHD_AccessHandlerCallback |
67 | * @param toe reason for request termination | 67 | * @param toe reason for request termination |
68 | * @see MHD_OPTION_NOTIFY_COMPLETED | 68 | * @see MHD_OPTION_NOTIFY_COMPLETED |
@@ -70,10 +70,10 @@ static struct MHD_Response *response; | |||
70 | static void | 70 | static void |
71 | completed_callback (void *cls, | 71 | completed_callback (void *cls, |
72 | struct MHD_Connection *connection, | 72 | struct MHD_Connection *connection, |
73 | void **con_cls, | 73 | void **req_cls, |
74 | enum MHD_RequestTerminationCode toe) | 74 | enum MHD_RequestTerminationCode toe) |
75 | { | 75 | { |
76 | struct timeval *tv = *con_cls; | 76 | struct timeval *tv = *req_cls; |
77 | struct timeval tve; | 77 | struct timeval tve; |
78 | uint64_t delta; | 78 | uint64_t delta; |
79 | (void) cls; /* Unused. Silent compiler warning. */ | 79 | (void) cls; /* Unused. Silent compiler warning. */ |
@@ -119,14 +119,14 @@ ahc_echo (void *cls, | |||
119 | const char *url, | 119 | const char *url, |
120 | const char *method, | 120 | const char *method, |
121 | const char *version, | 121 | const char *version, |
122 | const char *upload_data, size_t *upload_data_size, void **ptr) | 122 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
123 | { | 123 | { |
124 | (void) cls; /* Unused. Silent compiler warning. */ | 124 | (void) cls; /* Unused. Silent compiler warning. */ |
125 | (void) url; /* Unused. Silent compiler warning. */ | 125 | (void) url; /* Unused. Silent compiler warning. */ |
126 | (void) version; /* Unused. Silent compiler warning. */ | 126 | (void) version; /* Unused. Silent compiler warning. */ |
127 | (void) upload_data; /* Unused. Silent compiler warning. */ | 127 | (void) upload_data; /* Unused. Silent compiler warning. */ |
128 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 128 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
129 | (void) ptr; /* Unused. Silent compiler warning. */ | 129 | (void) req_cls; /* Unused. Silent compiler warning. */ |
130 | 130 | ||
131 | if (0 != strcmp (method, "GET")) | 131 | if (0 != strcmp (method, "GET")) |
132 | return MHD_NO; /* unexpected method */ | 132 | return MHD_NO; /* unexpected method */ |
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c index ddc3be19..36a46aa8 100644 --- a/src/examples/benchmark_https.c +++ b/src/examples/benchmark_https.c | |||
@@ -62,7 +62,7 @@ static struct MHD_Response *response; | |||
62 | * | 62 | * |
63 | * @param cls client-defined closure | 63 | * @param cls client-defined closure |
64 | * @param connection connection handle | 64 | * @param connection connection handle |
65 | * @param con_cls value as set by the last call to | 65 | * @param req_cls value as set by the last call to |
66 | * the MHD_AccessHandlerCallback | 66 | * the MHD_AccessHandlerCallback |
67 | * @param toe reason for request termination | 67 | * @param toe reason for request termination |
68 | * @see MHD_OPTION_NOTIFY_COMPLETED | 68 | * @see MHD_OPTION_NOTIFY_COMPLETED |
@@ -70,10 +70,10 @@ static struct MHD_Response *response; | |||
70 | static void | 70 | static void |
71 | completed_callback (void *cls, | 71 | completed_callback (void *cls, |
72 | struct MHD_Connection *connection, | 72 | struct MHD_Connection *connection, |
73 | void **con_cls, | 73 | void **req_cls, |
74 | enum MHD_RequestTerminationCode toe) | 74 | enum MHD_RequestTerminationCode toe) |
75 | { | 75 | { |
76 | struct timeval *tv = *con_cls; | 76 | struct timeval *tv = *req_cls; |
77 | struct timeval tve; | 77 | struct timeval tve; |
78 | uint64_t delta; | 78 | uint64_t delta; |
79 | (void) cls; /* Unused. Silent compiler warning. */ | 79 | (void) cls; /* Unused. Silent compiler warning. */ |
@@ -119,14 +119,14 @@ ahc_echo (void *cls, | |||
119 | const char *url, | 119 | const char *url, |
120 | const char *method, | 120 | const char *method, |
121 | const char *version, | 121 | const char *version, |
122 | const char *upload_data, size_t *upload_data_size, void **ptr) | 122 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
123 | { | 123 | { |
124 | (void) cls; /* Unused. Silent compiler warning. */ | 124 | (void) cls; /* Unused. Silent compiler warning. */ |
125 | (void) url; /* Unused. Silent compiler warning. */ | 125 | (void) url; /* Unused. Silent compiler warning. */ |
126 | (void) version; /* Unused. Silent compiler warning. */ | 126 | (void) version; /* Unused. Silent compiler warning. */ |
127 | (void) upload_data; /* Unused. Silent compiler warning. */ | 127 | (void) upload_data; /* Unused. Silent compiler warning. */ |
128 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 128 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
129 | (void) ptr; /* Unused. Silent compiler warning. */ | 129 | (void) req_cls; /* Unused. Silent compiler warning. */ |
130 | 130 | ||
131 | if (0 != strcmp (method, "GET")) | 131 | if (0 != strcmp (method, "GET")) |
132 | return MHD_NO; /* unexpected method */ | 132 | return MHD_NO; /* unexpected method */ |
diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c index 68b7ea1e..5a4c0ced 100644 --- a/src/examples/chunked_example.c +++ b/src/examples/chunked_example.c | |||
@@ -97,7 +97,7 @@ ahc_echo (void *cls, | |||
97 | const char *version, | 97 | const char *version, |
98 | const char *upload_data, | 98 | const char *upload_data, |
99 | size_t *upload_data_size, | 99 | size_t *upload_data_size, |
100 | void **ptr) | 100 | void **req_cls) |
101 | { | 101 | { |
102 | static int aptr; | 102 | static int aptr; |
103 | struct ResponseContentCallbackParam *callback_param; | 103 | struct ResponseContentCallbackParam *callback_param; |
@@ -111,10 +111,10 @@ ahc_echo (void *cls, | |||
111 | 111 | ||
112 | if (0 != strcmp (method, "GET")) | 112 | if (0 != strcmp (method, "GET")) |
113 | return MHD_NO; /* unexpected method */ | 113 | return MHD_NO; /* unexpected method */ |
114 | if (&aptr != *ptr) | 114 | if (&aptr != *req_cls) |
115 | { | 115 | { |
116 | /* do never respond on first call */ | 116 | /* do never respond on first call */ |
117 | *ptr = &aptr; | 117 | *req_cls = &aptr; |
118 | return MHD_YES; | 118 | return MHD_YES; |
119 | } | 119 | } |
120 | 120 | ||
@@ -126,7 +126,7 @@ ahc_echo (void *cls, | |||
126 | callback_param->response_size = (sizeof(simple_response_text) | 126 | callback_param->response_size = (sizeof(simple_response_text) |
127 | / sizeof(char)) - 1; | 127 | / sizeof(char)) - 1; |
128 | 128 | ||
129 | *ptr = NULL; /* reset when done */ | 129 | *req_cls = NULL; /* reset when done */ |
130 | response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, | 130 | response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, |
131 | 1024, | 131 | 1024, |
132 | &callback, | 132 | &callback, |
diff --git a/src/examples/connection_close.c b/src/examples/connection_close.c index 5629a687..e5f787a3 100644 --- a/src/examples/connection_close.c +++ b/src/examples/connection_close.c | |||
@@ -41,7 +41,7 @@ ahc_echo (void *cls, | |||
41 | const char *url, | 41 | const char *url, |
42 | const char *method, | 42 | const char *method, |
43 | const char *version, | 43 | const char *version, |
44 | const char *upload_data, size_t *upload_data_size, void **ptr) | 44 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
45 | { | 45 | { |
46 | static int aptr; | 46 | static int aptr; |
47 | const char *me = cls; | 47 | const char *me = cls; |
@@ -54,13 +54,13 @@ ahc_echo (void *cls, | |||
54 | 54 | ||
55 | if (0 != strcmp (method, "GET")) | 55 | if (0 != strcmp (method, "GET")) |
56 | return MHD_NO; /* unexpected method */ | 56 | return MHD_NO; /* unexpected method */ |
57 | if (&aptr != *ptr) | 57 | if (&aptr != *req_cls) |
58 | { | 58 | { |
59 | /* do never respond on first call */ | 59 | /* do never respond on first call */ |
60 | *ptr = &aptr; | 60 | *req_cls = &aptr; |
61 | return MHD_YES; | 61 | return MHD_YES; |
62 | } | 62 | } |
63 | *ptr = NULL; /* reset when done */ | 63 | *req_cls = NULL; /* reset when done */ |
64 | response = MHD_create_response_from_buffer (strlen (me), | 64 | response = MHD_create_response_from_buffer (strlen (me), |
65 | (void *) me, | 65 | (void *) me, |
66 | MHD_RESPMEM_PERSISTENT); | 66 | MHD_RESPMEM_PERSISTENT); |
@@ -75,7 +75,7 @@ ahc_echo (void *cls, | |||
75 | static void | 75 | static void |
76 | request_completed (void *cls, | 76 | request_completed (void *cls, |
77 | struct MHD_Connection *connection, | 77 | struct MHD_Connection *connection, |
78 | void **con_cls, | 78 | void **req_cls, |
79 | enum MHD_RequestTerminationCode toe) | 79 | enum MHD_RequestTerminationCode toe) |
80 | { | 80 | { |
81 | fprintf (stderr, | 81 | fprintf (stderr, |
diff --git a/src/examples/demo.c b/src/examples/demo.c index 0b6dc5f9..6ff7adae 100644 --- a/src/examples/demo.c +++ b/src/examples/demo.c | |||
@@ -619,7 +619,7 @@ process_upload_data (void *cls, | |||
619 | * | 619 | * |
620 | * @param cls client-defined closure, NULL | 620 | * @param cls client-defined closure, NULL |
621 | * @param connection connection handle | 621 | * @param connection connection handle |
622 | * @param con_cls value as set by the last call to | 622 | * @param req_cls value as set by the last call to |
623 | * the MHD_AccessHandlerCallback, points to NULL if this was | 623 | * the MHD_AccessHandlerCallback, points to NULL if this was |
624 | * not an upload | 624 | * not an upload |
625 | * @param toe reason for request termination | 625 | * @param toe reason for request termination |
@@ -627,10 +627,10 @@ process_upload_data (void *cls, | |||
627 | static void | 627 | static void |
628 | response_completed_callback (void *cls, | 628 | response_completed_callback (void *cls, |
629 | struct MHD_Connection *connection, | 629 | struct MHD_Connection *connection, |
630 | void **con_cls, | 630 | void **req_cls, |
631 | enum MHD_RequestTerminationCode toe) | 631 | enum MHD_RequestTerminationCode toe) |
632 | { | 632 | { |
633 | struct UploadContext *uc = *con_cls; | 633 | struct UploadContext *uc = *req_cls; |
634 | (void) cls; /* Unused. Silent compiler warning. */ | 634 | (void) cls; /* Unused. Silent compiler warning. */ |
635 | (void) connection; /* Unused. Silent compiler warning. */ | 635 | (void) connection; /* Unused. Silent compiler warning. */ |
636 | (void) toe; /* Unused. Silent compiler warning. */ | 636 | (void) toe; /* Unused. Silent compiler warning. */ |
@@ -694,7 +694,7 @@ return_directory_response (struct MHD_Connection *connection) | |||
694 | * @param version HTTP version | 694 | * @param version HTTP version |
695 | * @param upload_data data from upload (PUT/POST) | 695 | * @param upload_data data from upload (PUT/POST) |
696 | * @param upload_data_size number of bytes in @a upload_data | 696 | * @param upload_data_size number of bytes in @a upload_data |
697 | * @param ptr our context | 697 | * @param req_cls our context |
698 | * @return #MHD_YES on success, #MHD_NO to drop connection | 698 | * @return #MHD_YES on success, #MHD_NO to drop connection |
699 | */ | 699 | */ |
700 | static enum MHD_Result | 700 | static enum MHD_Result |
@@ -704,7 +704,7 @@ generate_page (void *cls, | |||
704 | const char *method, | 704 | const char *method, |
705 | const char *version, | 705 | const char *version, |
706 | const char *upload_data, | 706 | const char *upload_data, |
707 | size_t *upload_data_size, void **ptr) | 707 | size_t *upload_data_size, void **req_cls) |
708 | { | 708 | { |
709 | struct MHD_Response *response; | 709 | struct MHD_Response *response; |
710 | enum MHD_Result ret; | 710 | enum MHD_Result ret; |
@@ -775,7 +775,7 @@ generate_page (void *cls, | |||
775 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) | 775 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) |
776 | { | 776 | { |
777 | /* upload! */ | 777 | /* upload! */ |
778 | struct UploadContext *uc = *ptr; | 778 | struct UploadContext *uc = *req_cls; |
779 | 779 | ||
780 | if (NULL == uc) | 780 | if (NULL == uc) |
781 | { | 781 | { |
@@ -793,7 +793,7 @@ generate_page (void *cls, | |||
793 | free (uc); | 793 | free (uc); |
794 | return MHD_NO; | 794 | return MHD_NO; |
795 | } | 795 | } |
796 | *ptr = uc; | 796 | *req_cls = uc; |
797 | return MHD_YES; | 797 | return MHD_YES; |
798 | } | 798 | } |
799 | if (0 != *upload_data_size) | 799 | if (0 != *upload_data_size) |
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c index d4e1d77f..ef59e7d9 100644 --- a/src/examples/demo_https.c +++ b/src/examples/demo_https.c | |||
@@ -621,7 +621,7 @@ process_upload_data (void *cls, | |||
621 | * | 621 | * |
622 | * @param cls client-defined closure, NULL | 622 | * @param cls client-defined closure, NULL |
623 | * @param connection connection handle | 623 | * @param connection connection handle |
624 | * @param con_cls value as set by the last call to | 624 | * @param req_cls value as set by the last call to |
625 | * the MHD_AccessHandlerCallback, points to NULL if this was | 625 | * the MHD_AccessHandlerCallback, points to NULL if this was |
626 | * not an upload | 626 | * not an upload |
627 | * @param toe reason for request termination | 627 | * @param toe reason for request termination |
@@ -629,10 +629,10 @@ process_upload_data (void *cls, | |||
629 | static void | 629 | static void |
630 | response_completed_callback (void *cls, | 630 | response_completed_callback (void *cls, |
631 | struct MHD_Connection *connection, | 631 | struct MHD_Connection *connection, |
632 | void **con_cls, | 632 | void **req_cls, |
633 | enum MHD_RequestTerminationCode toe) | 633 | enum MHD_RequestTerminationCode toe) |
634 | { | 634 | { |
635 | struct UploadContext *uc = *con_cls; | 635 | struct UploadContext *uc = *req_cls; |
636 | (void) cls; /* Unused. Silent compiler warning. */ | 636 | (void) cls; /* Unused. Silent compiler warning. */ |
637 | (void) connection; /* Unused. Silent compiler warning. */ | 637 | (void) connection; /* Unused. Silent compiler warning. */ |
638 | (void) toe; /* Unused. Silent compiler warning. */ | 638 | (void) toe; /* Unused. Silent compiler warning. */ |
@@ -696,7 +696,7 @@ return_directory_response (struct MHD_Connection *connection) | |||
696 | * @param version HTTP version | 696 | * @param version HTTP version |
697 | * @param upload_data data from upload (PUT/POST) | 697 | * @param upload_data data from upload (PUT/POST) |
698 | * @param upload_data_size number of bytes in "upload_data" | 698 | * @param upload_data_size number of bytes in "upload_data" |
699 | * @param ptr our context | 699 | * @param req_cls our context |
700 | * @return #MHD_YES on success, #MHD_NO to drop connection | 700 | * @return #MHD_YES on success, #MHD_NO to drop connection |
701 | */ | 701 | */ |
702 | static enum MHD_Result | 702 | static enum MHD_Result |
@@ -706,7 +706,7 @@ generate_page (void *cls, | |||
706 | const char *method, | 706 | const char *method, |
707 | const char *version, | 707 | const char *version, |
708 | const char *upload_data, | 708 | const char *upload_data, |
709 | size_t *upload_data_size, void **ptr) | 709 | size_t *upload_data_size, void **req_cls) |
710 | { | 710 | { |
711 | struct MHD_Response *response; | 711 | struct MHD_Response *response; |
712 | enum MHD_Result ret; | 712 | enum MHD_Result ret; |
@@ -776,7 +776,7 @@ generate_page (void *cls, | |||
776 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) | 776 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) |
777 | { | 777 | { |
778 | /* upload! */ | 778 | /* upload! */ |
779 | struct UploadContext *uc = *ptr; | 779 | struct UploadContext *uc = *req_cls; |
780 | 780 | ||
781 | if (NULL == uc) | 781 | if (NULL == uc) |
782 | { | 782 | { |
@@ -794,7 +794,7 @@ generate_page (void *cls, | |||
794 | free (uc); | 794 | free (uc); |
795 | return MHD_NO; | 795 | return MHD_NO; |
796 | } | 796 | } |
797 | *ptr = uc; | 797 | *req_cls = uc; |
798 | return MHD_YES; | 798 | return MHD_YES; |
799 | } | 799 | } |
800 | if (0 != *upload_data_size) | 800 | if (0 != *upload_data_size) |
diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c index 073726ad..44faefeb 100644 --- a/src/examples/digest_auth_example.c +++ b/src/examples/digest_auth_example.c | |||
@@ -40,7 +40,7 @@ ahc_echo (void *cls, | |||
40 | const char *url, | 40 | const char *url, |
41 | const char *method, | 41 | const char *method, |
42 | const char *version, | 42 | const char *version, |
43 | const char *upload_data, size_t *upload_data_size, void **ptr) | 43 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
44 | { | 44 | { |
45 | struct MHD_Response *response; | 45 | struct MHD_Response *response; |
46 | char *username; | 46 | char *username; |
@@ -54,7 +54,7 @@ ahc_echo (void *cls, | |||
54 | (void) version; /* Unused. Silent compiler warning. */ | 54 | (void) version; /* Unused. Silent compiler warning. */ |
55 | (void) upload_data; /* Unused. Silent compiler warning. */ | 55 | (void) upload_data; /* Unused. Silent compiler warning. */ |
56 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 56 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
57 | (void) ptr; /* Unused. Silent compiler warning. */ | 57 | (void) req_cls; /* Unused. Silent compiler warning. */ |
58 | 58 | ||
59 | username = MHD_digest_auth_get_username (connection); | 59 | username = MHD_digest_auth_get_username (connection); |
60 | if (NULL == username) | 60 | if (NULL == username) |
diff --git a/src/examples/dual_stack_example.c b/src/examples/dual_stack_example.c index 15bafc44..175583ac 100644 --- a/src/examples/dual_stack_example.c +++ b/src/examples/dual_stack_example.c | |||
@@ -34,7 +34,7 @@ ahc_echo (void *cls, | |||
34 | const char *url, | 34 | const char *url, |
35 | const char *method, | 35 | const char *method, |
36 | const char *version, | 36 | const char *version, |
37 | const char *upload_data, size_t *upload_data_size, void **ptr) | 37 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
38 | { | 38 | { |
39 | static int aptr; | 39 | static int aptr; |
40 | const char *me = cls; | 40 | const char *me = cls; |
@@ -47,13 +47,13 @@ ahc_echo (void *cls, | |||
47 | 47 | ||
48 | if (0 != strcmp (method, "GET")) | 48 | if (0 != strcmp (method, "GET")) |
49 | return MHD_NO; /* unexpected method */ | 49 | return MHD_NO; /* unexpected method */ |
50 | if (&aptr != *ptr) | 50 | if (&aptr != *req_cls) |
51 | { | 51 | { |
52 | /* do never respond on first call */ | 52 | /* do never respond on first call */ |
53 | *ptr = &aptr; | 53 | *req_cls = &aptr; |
54 | return MHD_YES; | 54 | return MHD_YES; |
55 | } | 55 | } |
56 | *ptr = NULL; /* reset when done */ | 56 | *req_cls = NULL; /* reset when done */ |
57 | response = MHD_create_response_from_buffer (strlen (me), | 57 | response = MHD_create_response_from_buffer (strlen (me), |
58 | (void *) me, | 58 | (void *) me, |
59 | MHD_RESPMEM_PERSISTENT); | 59 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c index 94c2ca95..76879eec 100644 --- a/src/examples/fileserver_example.c +++ b/src/examples/fileserver_example.c | |||
@@ -48,7 +48,7 @@ ahc_echo (void *cls, | |||
48 | const char *method, | 48 | const char *method, |
49 | const char *version, | 49 | const char *version, |
50 | const char *upload_data, | 50 | const char *upload_data, |
51 | size_t *upload_data_size, void **ptr) | 51 | size_t *upload_data_size, void **req_cls) |
52 | { | 52 | { |
53 | static int aptr; | 53 | static int aptr; |
54 | struct MHD_Response *response; | 54 | struct MHD_Response *response; |
@@ -63,13 +63,13 @@ ahc_echo (void *cls, | |||
63 | if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) && | 63 | if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) && |
64 | (0 != strcmp (method, MHD_HTTP_METHOD_HEAD)) ) | 64 | (0 != strcmp (method, MHD_HTTP_METHOD_HEAD)) ) |
65 | return MHD_NO; /* unexpected method */ | 65 | return MHD_NO; /* unexpected method */ |
66 | if (&aptr != *ptr) | 66 | if (&aptr != *req_cls) |
67 | { | 67 | { |
68 | /* do never respond on first call */ | 68 | /* do never respond on first call */ |
69 | *ptr = &aptr; | 69 | *req_cls = &aptr; |
70 | return MHD_YES; | 70 | return MHD_YES; |
71 | } | 71 | } |
72 | *ptr = NULL; /* reset when done */ | 72 | *req_cls = NULL; /* reset when done */ |
73 | /* WARNING: direct usage of url as filename is for example only! | 73 | /* WARNING: direct usage of url as filename is for example only! |
74 | * NEVER pass received data directly as parameter to file manipulation | 74 | * NEVER pass received data directly as parameter to file manipulation |
75 | * functions. Always check validity of data before using. | 75 | * functions. Always check validity of data before using. |
diff --git a/src/examples/fileserver_example_dirs.c b/src/examples/fileserver_example_dirs.c index e6c9ed1f..796cb42e 100644 --- a/src/examples/fileserver_example_dirs.c +++ b/src/examples/fileserver_example_dirs.c | |||
@@ -88,7 +88,7 @@ ahc_echo (void *cls, | |||
88 | const char *method, | 88 | const char *method, |
89 | const char *version, | 89 | const char *version, |
90 | const char *upload_data, | 90 | const char *upload_data, |
91 | size_t *upload_data_size, void **ptr) | 91 | size_t *upload_data_size, void **req_cls) |
92 | { | 92 | { |
93 | static int aptr; | 93 | static int aptr; |
94 | struct MHD_Response *response; | 94 | struct MHD_Response *response; |
@@ -105,13 +105,13 @@ ahc_echo (void *cls, | |||
105 | 105 | ||
106 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) | 106 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) |
107 | return MHD_NO; /* unexpected method */ | 107 | return MHD_NO; /* unexpected method */ |
108 | if (&aptr != *ptr) | 108 | if (&aptr != *req_cls) |
109 | { | 109 | { |
110 | /* do never respond on first call */ | 110 | /* do never respond on first call */ |
111 | *ptr = &aptr; | 111 | *req_cls = &aptr; |
112 | return MHD_YES; | 112 | return MHD_YES; |
113 | } | 113 | } |
114 | *ptr = NULL; /* reset when done */ | 114 | *req_cls = NULL; /* reset when done */ |
115 | 115 | ||
116 | file = fopen (&url[1], "rb"); | 116 | file = fopen (&url[1], "rb"); |
117 | if (NULL != file) | 117 | if (NULL != file) |
diff --git a/src/examples/fileserver_example_external_select.c b/src/examples/fileserver_example_external_select.c index 7209751f..09f7be0a 100644 --- a/src/examples/fileserver_example_external_select.c +++ b/src/examples/fileserver_example_external_select.c | |||
@@ -55,7 +55,7 @@ ahc_echo (void *cls, | |||
55 | const char *method, | 55 | const char *method, |
56 | const char *version, | 56 | const char *version, |
57 | const char *upload_data, | 57 | const char *upload_data, |
58 | size_t *upload_data_size, void **ptr) | 58 | size_t *upload_data_size, void **req_cls) |
59 | { | 59 | { |
60 | static int aptr; | 60 | static int aptr; |
61 | struct MHD_Response *response; | 61 | struct MHD_Response *response; |
@@ -70,13 +70,13 @@ ahc_echo (void *cls, | |||
70 | 70 | ||
71 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) | 71 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) |
72 | return MHD_NO; /* unexpected method */ | 72 | return MHD_NO; /* unexpected method */ |
73 | if (&aptr != *ptr) | 73 | if (&aptr != *req_cls) |
74 | { | 74 | { |
75 | /* do never respond on first call */ | 75 | /* do never respond on first call */ |
76 | *ptr = &aptr; | 76 | *req_cls = &aptr; |
77 | return MHD_YES; | 77 | return MHD_YES; |
78 | } | 78 | } |
79 | *ptr = NULL; /* reset when done */ | 79 | *req_cls = NULL; /* reset when done */ |
80 | 80 | ||
81 | file = fopen (&url[1], "rb"); | 81 | file = fopen (&url[1], "rb"); |
82 | if (NULL != file) | 82 | if (NULL != file) |
diff --git a/src/examples/http_chunked_compression.c b/src/examples/http_chunked_compression.c index f6baf0fd..7b8ed1fc 100644 --- a/src/examples/http_chunked_compression.c +++ b/src/examples/http_chunked_compression.c | |||
@@ -156,7 +156,7 @@ free_cb (void *cls) | |||
156 | static enum MHD_Result | 156 | static enum MHD_Result |
157 | ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const | 157 | ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const |
158 | char *method, const char *version, | 158 | char *method, const char *version, |
159 | const char *upload_data, size_t *upload_size, void **ptr) | 159 | const char *upload_data, size_t *upload_size, void **req_cls) |
160 | { | 160 | { |
161 | struct Holder *holder; | 161 | struct Holder *holder; |
162 | struct MHD_Response *res; | 162 | struct MHD_Response *res; |
@@ -167,12 +167,12 @@ ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const | |||
167 | (void) version; | 167 | (void) version; |
168 | (void) upload_data; | 168 | (void) upload_data; |
169 | (void) upload_size; | 169 | (void) upload_size; |
170 | if (NULL == *ptr) | 170 | if (NULL == *req_cls) |
171 | { | 171 | { |
172 | *ptr = (void *) 1; | 172 | *req_cls = (void *) 1; |
173 | return MHD_YES; | 173 | return MHD_YES; |
174 | } | 174 | } |
175 | *ptr = NULL; | 175 | *req_cls = NULL; |
176 | holder = calloc (1, sizeof (struct Holder)); | 176 | holder = calloc (1, sizeof (struct Holder)); |
177 | if (! holder) | 177 | if (! holder) |
178 | return MHD_NO; | 178 | return MHD_NO; |
diff --git a/src/examples/http_compression.c b/src/examples/http_compression.c index 0419a803..a91a39a3 100644 --- a/src/examples/http_compression.c +++ b/src/examples/http_compression.c | |||
@@ -96,7 +96,7 @@ ahc_echo (void *cls, | |||
96 | const char *url, | 96 | const char *url, |
97 | const char *method, | 97 | const char *method, |
98 | const char *version, | 98 | const char *version, |
99 | const char *upload_data, size_t *upload_data_size, void **ptr) | 99 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
100 | { | 100 | { |
101 | struct MHD_Response *response; | 101 | struct MHD_Response *response; |
102 | enum MHD_Result ret; | 102 | enum MHD_Result ret; |
@@ -111,12 +111,12 @@ ahc_echo (void *cls, | |||
111 | 111 | ||
112 | if (0 != strcmp (method, "GET")) | 112 | if (0 != strcmp (method, "GET")) |
113 | return MHD_NO; /* unexpected method */ | 113 | return MHD_NO; /* unexpected method */ |
114 | if (! *ptr) | 114 | if (! *req_cls) |
115 | { | 115 | { |
116 | *ptr = (void *) 1; | 116 | *req_cls = (void *) 1; |
117 | return MHD_YES; | 117 | return MHD_YES; |
118 | } | 118 | } |
119 | *ptr = NULL; | 119 | *req_cls = NULL; |
120 | 120 | ||
121 | body_str = strdup (PAGE); | 121 | body_str = strdup (PAGE); |
122 | if (NULL == body_str) | 122 | if (NULL == body_str) |
diff --git a/src/examples/https_fileserver_example.c b/src/examples/https_fileserver_example.c index babad604..5dc340f7 100644 --- a/src/examples/https_fileserver_example.c +++ b/src/examples/https_fileserver_example.c | |||
@@ -137,7 +137,7 @@ http_ahc (void *cls, | |||
137 | const char *method, | 137 | const char *method, |
138 | const char *version, | 138 | const char *version, |
139 | const char *upload_data, | 139 | const char *upload_data, |
140 | size_t *upload_data_size, void **ptr) | 140 | size_t *upload_data_size, void **req_cls) |
141 | { | 141 | { |
142 | static int aptr; | 142 | static int aptr; |
143 | struct MHD_Response *response; | 143 | struct MHD_Response *response; |
@@ -152,13 +152,13 @@ http_ahc (void *cls, | |||
152 | 152 | ||
153 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) | 153 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) |
154 | return MHD_NO; /* unexpected method */ | 154 | return MHD_NO; /* unexpected method */ |
155 | if (&aptr != *ptr) | 155 | if (&aptr != *req_cls) |
156 | { | 156 | { |
157 | /* do never respond on first call */ | 157 | /* do never respond on first call */ |
158 | *ptr = &aptr; | 158 | *req_cls = &aptr; |
159 | return MHD_YES; | 159 | return MHD_YES; |
160 | } | 160 | } |
161 | *ptr = NULL; /* reset when done */ | 161 | *req_cls = NULL; /* reset when done */ |
162 | 162 | ||
163 | file = fopen (&url[1], "rb"); | 163 | file = fopen (&url[1], "rb"); |
164 | if (NULL != file) | 164 | if (NULL != file) |
diff --git a/src/examples/minimal_example.c b/src/examples/minimal_example.c index a02b5d50..ce604555 100644 --- a/src/examples/minimal_example.c +++ b/src/examples/minimal_example.c | |||
@@ -36,7 +36,7 @@ ahc_echo (void *cls, | |||
36 | const char *version, | 36 | const char *version, |
37 | const char *upload_data, | 37 | const char *upload_data, |
38 | size_t *upload_data_size, | 38 | size_t *upload_data_size, |
39 | void **ptr) | 39 | void **req_cls) |
40 | { | 40 | { |
41 | static int aptr; | 41 | static int aptr; |
42 | const char *me = cls; | 42 | const char *me = cls; |
@@ -50,13 +50,13 @@ ahc_echo (void *cls, | |||
50 | 50 | ||
51 | if (0 != strcmp (method, "GET")) | 51 | if (0 != strcmp (method, "GET")) |
52 | return MHD_NO; /* unexpected method */ | 52 | return MHD_NO; /* unexpected method */ |
53 | if (&aptr != *ptr) | 53 | if (&aptr != *req_cls) |
54 | { | 54 | { |
55 | /* do never respond on first call */ | 55 | /* do never respond on first call */ |
56 | *ptr = &aptr; | 56 | *req_cls = &aptr; |
57 | return MHD_YES; | 57 | return MHD_YES; |
58 | } | 58 | } |
59 | *ptr = NULL; /* reset when done */ | 59 | *req_cls = NULL; /* reset when done */ |
60 | response = MHD_create_response_from_buffer (strlen (me), | 60 | response = MHD_create_response_from_buffer (strlen (me), |
61 | (void *) me, | 61 | (void *) me, |
62 | MHD_RESPMEM_PERSISTENT); | 62 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/examples/minimal_example_comet.c b/src/examples/minimal_example_comet.c index c36bf2ce..a8864d89 100644 --- a/src/examples/minimal_example_comet.c +++ b/src/examples/minimal_example_comet.c | |||
@@ -44,7 +44,7 @@ ahc_echo (void *cls, | |||
44 | const char *url, | 44 | const char *url, |
45 | const char *method, | 45 | const char *method, |
46 | const char *version, | 46 | const char *version, |
47 | const char *upload_data, size_t *upload_data_size, void **ptr) | 47 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
48 | { | 48 | { |
49 | static int aptr; | 49 | static int aptr; |
50 | struct MHD_Response *response; | 50 | struct MHD_Response *response; |
@@ -57,13 +57,13 @@ ahc_echo (void *cls, | |||
57 | 57 | ||
58 | if (0 != strcmp (method, "GET")) | 58 | if (0 != strcmp (method, "GET")) |
59 | return MHD_NO; /* unexpected method */ | 59 | return MHD_NO; /* unexpected method */ |
60 | if (&aptr != *ptr) | 60 | if (&aptr != *req_cls) |
61 | { | 61 | { |
62 | /* do never respond on first call */ | 62 | /* do never respond on first call */ |
63 | *ptr = &aptr; | 63 | *req_cls = &aptr; |
64 | return MHD_YES; | 64 | return MHD_YES; |
65 | } | 65 | } |
66 | *ptr = NULL; /* reset when done */ | 66 | *req_cls = NULL; /* reset when done */ |
67 | response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, | 67 | response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, |
68 | 80, | 68 | 80, |
69 | &data_generator, NULL, NULL); | 69 | &data_generator, NULL, NULL); |
diff --git a/src/examples/minimal_example_empty.c b/src/examples/minimal_example_empty.c index d692e0d8..43719a24 100644 --- a/src/examples/minimal_example_empty.c +++ b/src/examples/minimal_example_empty.c | |||
@@ -34,7 +34,7 @@ ahc_echo (void *cls, | |||
34 | const char *version, | 34 | const char *version, |
35 | const char *upload_data, | 35 | const char *upload_data, |
36 | size_t *upload_data_size, | 36 | size_t *upload_data_size, |
37 | void **ptr) | 37 | void **req_cls) |
38 | { | 38 | { |
39 | static int aptr; | 39 | static int aptr; |
40 | struct MHD_Response *response; | 40 | struct MHD_Response *response; |
@@ -48,13 +48,13 @@ ahc_echo (void *cls, | |||
48 | 48 | ||
49 | if (0 != strcmp (method, "GET")) | 49 | if (0 != strcmp (method, "GET")) |
50 | return MHD_NO; /* unexpected method */ | 50 | return MHD_NO; /* unexpected method */ |
51 | if (&aptr != *ptr) | 51 | if (&aptr != *req_cls) |
52 | { | 52 | { |
53 | /* do never respond on first call */ | 53 | /* do never respond on first call */ |
54 | *ptr = &aptr; | 54 | *req_cls = &aptr; |
55 | return MHD_YES; | 55 | return MHD_YES; |
56 | } | 56 | } |
57 | *ptr = NULL; /* reset when done */ | 57 | *req_cls = NULL; /* reset when done */ |
58 | response = MHD_create_response_from_buffer (0, | 58 | response = MHD_create_response_from_buffer (0, |
59 | NULL, | 59 | NULL, |
60 | MHD_RESPMEM_PERSISTENT); | 60 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/examples/minimal_example_empty_tls.c b/src/examples/minimal_example_empty_tls.c index 70d7bd71..f03884c8 100644 --- a/src/examples/minimal_example_empty_tls.c +++ b/src/examples/minimal_example_empty_tls.c | |||
@@ -34,7 +34,7 @@ ahc_echo (void *cls, | |||
34 | const char *version, | 34 | const char *version, |
35 | const char *upload_data, | 35 | const char *upload_data, |
36 | size_t *upload_data_size, | 36 | size_t *upload_data_size, |
37 | void **ptr) | 37 | void **req_cls) |
38 | { | 38 | { |
39 | static int aptr; | 39 | static int aptr; |
40 | struct MHD_Response *response; | 40 | struct MHD_Response *response; |
@@ -48,13 +48,13 @@ ahc_echo (void *cls, | |||
48 | 48 | ||
49 | if (0 != strcmp (method, "GET")) | 49 | if (0 != strcmp (method, "GET")) |
50 | return MHD_NO; /* unexpected method */ | 50 | return MHD_NO; /* unexpected method */ |
51 | if (&aptr != *ptr) | 51 | if (&aptr != *req_cls) |
52 | { | 52 | { |
53 | /* do never respond on first call */ | 53 | /* do never respond on first call */ |
54 | *ptr = &aptr; | 54 | *req_cls = &aptr; |
55 | return MHD_YES; | 55 | return MHD_YES; |
56 | } | 56 | } |
57 | *ptr = NULL; /* reset when done */ | 57 | *req_cls = NULL; /* reset when done */ |
58 | response = MHD_create_response_from_buffer (0, | 58 | response = MHD_create_response_from_buffer (0, |
59 | NULL, | 59 | NULL, |
60 | MHD_RESPMEM_PERSISTENT); | 60 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/examples/msgs_i18n.c b/src/examples/msgs_i18n.c index 56f9f501..5d563e4f 100644 --- a/src/examples/msgs_i18n.c +++ b/src/examples/msgs_i18n.c | |||
@@ -51,7 +51,7 @@ ahc_echo (void *cls, | |||
51 | const char *ver, | 51 | const char *ver, |
52 | const char *upd, | 52 | const char *upd, |
53 | size_t *upsz, | 53 | size_t *upsz, |
54 | void **ptr) | 54 | void **req_cls) |
55 | { | 55 | { |
56 | return MHD_NO; | 56 | return MHD_NO; |
57 | } | 57 | } |
diff --git a/src/examples/post_example.c b/src/examples/post_example.c index 9f4fbcf9..d8f58d49 100644 --- a/src/examples/post_example.c +++ b/src/examples/post_example.c | |||
@@ -540,7 +540,7 @@ post_iterator (void *cls, | |||
540 | * @param upload_data_size set initially to the size of the | 540 | * @param upload_data_size set initially to the size of the |
541 | * upload_data provided; the method must update this | 541 | * upload_data provided; the method must update this |
542 | * value to the number of bytes NOT processed; | 542 | * value to the number of bytes NOT processed; |
543 | * @param ptr pointer that the callback can set to some | 543 | * @param req_cls pointer that the callback can set to some |
544 | * address and that will be preserved by MHD for future | 544 | * address and that will be preserved by MHD for future |
545 | * calls for this request; since the access handler may | 545 | * calls for this request; since the access handler may |
546 | * be called many times (i.e., for a PUT/POST operation | 546 | * be called many times (i.e., for a PUT/POST operation |
@@ -549,7 +549,7 @@ post_iterator (void *cls, | |||
549 | * If necessary, this state can be cleaned up in the | 549 | * If necessary, this state can be cleaned up in the |
550 | * global "MHD_RequestCompleted" callback (which | 550 | * global "MHD_RequestCompleted" callback (which |
551 | * can be set with the MHD_OPTION_NOTIFY_COMPLETED). | 551 | * can be set with the MHD_OPTION_NOTIFY_COMPLETED). |
552 | * Initially, <tt>*con_cls</tt> will be NULL. | 552 | * Initially, <tt>*req_cls</tt> will be NULL. |
553 | * @return MHS_YES if the connection was handled successfully, | 553 | * @return MHS_YES if the connection was handled successfully, |
554 | * MHS_NO if the socket must be closed due to a serious | 554 | * MHS_NO if the socket must be closed due to a serious |
555 | * error while handling the request | 555 | * error while handling the request |
@@ -562,7 +562,7 @@ create_response (void *cls, | |||
562 | const char *version, | 562 | const char *version, |
563 | const char *upload_data, | 563 | const char *upload_data, |
564 | size_t *upload_data_size, | 564 | size_t *upload_data_size, |
565 | void **ptr) | 565 | void **req_cls) |
566 | { | 566 | { |
567 | struct MHD_Response *response; | 567 | struct MHD_Response *response; |
568 | struct Request *request; | 568 | struct Request *request; |
@@ -572,7 +572,7 @@ create_response (void *cls, | |||
572 | (void) cls; /* Unused. Silent compiler warning. */ | 572 | (void) cls; /* Unused. Silent compiler warning. */ |
573 | (void) version; /* Unused. Silent compiler warning. */ | 573 | (void) version; /* Unused. Silent compiler warning. */ |
574 | 574 | ||
575 | request = *ptr; | 575 | request = *req_cls; |
576 | if (NULL == request) | 576 | if (NULL == request) |
577 | { | 577 | { |
578 | request = calloc (1, sizeof (struct Request)); | 578 | request = calloc (1, sizeof (struct Request)); |
@@ -581,7 +581,7 @@ create_response (void *cls, | |||
581 | fprintf (stderr, "calloc error: %s\n", strerror (errno)); | 581 | fprintf (stderr, "calloc error: %s\n", strerror (errno)); |
582 | return MHD_NO; | 582 | return MHD_NO; |
583 | } | 583 | } |
584 | *ptr = request; | 584 | *req_cls = request; |
585 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) | 585 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) |
586 | { | 586 | { |
587 | request->pp = MHD_create_post_processor (connection, 1024, | 587 | request->pp = MHD_create_post_processor (connection, 1024, |
@@ -660,16 +660,16 @@ create_response (void *cls, | |||
660 | * | 660 | * |
661 | * @param cls not used | 661 | * @param cls not used |
662 | * @param connection connection that completed | 662 | * @param connection connection that completed |
663 | * @param con_cls session handle | 663 | * @param req_cls session handle |
664 | * @param toe status code | 664 | * @param toe status code |
665 | */ | 665 | */ |
666 | static void | 666 | static void |
667 | request_completed_callback (void *cls, | 667 | request_completed_callback (void *cls, |
668 | struct MHD_Connection *connection, | 668 | struct MHD_Connection *connection, |
669 | void **con_cls, | 669 | void **req_cls, |
670 | enum MHD_RequestTerminationCode toe) | 670 | enum MHD_RequestTerminationCode toe) |
671 | { | 671 | { |
672 | struct Request *request = *con_cls; | 672 | struct Request *request = *req_cls; |
673 | (void) cls; /* Unused. Silent compiler warning. */ | 673 | (void) cls; /* Unused. Silent compiler warning. */ |
674 | (void) connection; /* Unused. Silent compiler warning. */ | 674 | (void) connection; /* Unused. Silent compiler warning. */ |
675 | (void) toe; /* Unused. Silent compiler warning. */ | 675 | (void) toe; /* Unused. Silent compiler warning. */ |
diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c index 975d17f2..d33767cb 100644 --- a/src/examples/querystring_example.c +++ b/src/examples/querystring_example.c | |||
@@ -35,7 +35,7 @@ ahc_echo (void *cls, | |||
35 | const char *url, | 35 | const char *url, |
36 | const char *method, | 36 | const char *method, |
37 | const char *version, | 37 | const char *version, |
38 | const char *upload_data, size_t *upload_data_size, void **ptr) | 38 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
39 | { | 39 | { |
40 | static int aptr; | 40 | static int aptr; |
41 | const char *fmt = cls; | 41 | const char *fmt = cls; |
@@ -51,13 +51,13 @@ ahc_echo (void *cls, | |||
51 | 51 | ||
52 | if (0 != strcmp (method, "GET")) | 52 | if (0 != strcmp (method, "GET")) |
53 | return MHD_NO; /* unexpected method */ | 53 | return MHD_NO; /* unexpected method */ |
54 | if (&aptr != *ptr) | 54 | if (&aptr != *req_cls) |
55 | { | 55 | { |
56 | /* do never respond on first call */ | 56 | /* do never respond on first call */ |
57 | *ptr = &aptr; | 57 | *req_cls = &aptr; |
58 | return MHD_YES; | 58 | return MHD_YES; |
59 | } | 59 | } |
60 | *ptr = NULL; /* reset when done */ | 60 | *req_cls = NULL; /* reset when done */ |
61 | if (NULL == fmt) | 61 | if (NULL == fmt) |
62 | return MHD_NO; /* The cls must not be NULL */ | 62 | return MHD_NO; /* The cls must not be NULL */ |
63 | val = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "q"); | 63 | val = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "q"); |
diff --git a/src/examples/refuse_post_example.c b/src/examples/refuse_post_example.c index 7e100d9f..dc261575 100644 --- a/src/examples/refuse_post_example.c +++ b/src/examples/refuse_post_example.c | |||
@@ -41,7 +41,7 @@ ahc_echo (void *cls, | |||
41 | const char *url, | 41 | const char *url, |
42 | const char *method, | 42 | const char *method, |
43 | const char *version, | 43 | const char *version, |
44 | const char *upload_data, size_t *upload_data_size, void **ptr) | 44 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
45 | { | 45 | { |
46 | static int aptr; | 46 | static int aptr; |
47 | const char *me = cls; | 47 | const char *me = cls; |
@@ -56,9 +56,9 @@ ahc_echo (void *cls, | |||
56 | if ((0 != strcmp (method, "GET")) && (0 != strcmp (method, "POST"))) | 56 | if ((0 != strcmp (method, "GET")) && (0 != strcmp (method, "POST"))) |
57 | return MHD_NO; /* unexpected method */ | 57 | return MHD_NO; /* unexpected method */ |
58 | 58 | ||
59 | if (&aptr != *ptr) | 59 | if (&aptr != *req_cls) |
60 | { | 60 | { |
61 | *ptr = &aptr; | 61 | *req_cls = &aptr; |
62 | 62 | ||
63 | /* always to busy for POST requests */ | 63 | /* always to busy for POST requests */ |
64 | if (0 == strcmp (method, "POST")) | 64 | if (0 == strcmp (method, "POST")) |
@@ -74,7 +74,7 @@ ahc_echo (void *cls, | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | *ptr = NULL; /* reset when done */ | 77 | *req_cls = NULL; /* reset when done */ |
78 | response = MHD_create_response_from_buffer (strlen (me), | 78 | response = MHD_create_response_from_buffer (strlen (me), |
79 | (void *) me, | 79 | (void *) me, |
80 | MHD_RESPMEM_PERSISTENT); | 80 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/examples/suspend_resume_epoll.c b/src/examples/suspend_resume_epoll.c index d25c3b21..6b660b00 100644 --- a/src/examples/suspend_resume_epoll.c +++ b/src/examples/suspend_resume_epoll.c | |||
@@ -49,7 +49,7 @@ ahc_echo (void *cls, | |||
49 | const char *url, | 49 | const char *url, |
50 | const char *method, | 50 | const char *method, |
51 | const char *version, | 51 | const char *version, |
52 | const char *upload_data, size_t *upload_data_size, void **ptr) | 52 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
53 | { | 53 | { |
54 | struct MHD_Response *response; | 54 | struct MHD_Response *response; |
55 | enum MHD_Result ret; | 55 | enum MHD_Result ret; |
@@ -62,7 +62,7 @@ ahc_echo (void *cls, | |||
62 | (void) version; /* Unused. Silence compiler warning. */ | 62 | (void) version; /* Unused. Silence compiler warning. */ |
63 | (void) upload_data; /* Unused. Silence compiler warning. */ | 63 | (void) upload_data; /* Unused. Silence compiler warning. */ |
64 | (void) upload_data_size; /* Unused. Silence compiler warning. */ | 64 | (void) upload_data_size; /* Unused. Silence compiler warning. */ |
65 | req = *ptr; | 65 | req = *req_cls; |
66 | if (NULL == req) | 66 | if (NULL == req) |
67 | { | 67 | { |
68 | 68 | ||
@@ -71,7 +71,7 @@ ahc_echo (void *cls, | |||
71 | return MHD_NO; | 71 | return MHD_NO; |
72 | req->connection = connection; | 72 | req->connection = connection; |
73 | req->timerfd = -1; | 73 | req->timerfd = -1; |
74 | *ptr = req; | 74 | *req_cls = req; |
75 | return MHD_YES; | 75 | return MHD_YES; |
76 | } | 76 | } |
77 | 77 | ||
@@ -120,10 +120,10 @@ ahc_echo (void *cls, | |||
120 | static void | 120 | static void |
121 | connection_done (void *cls, | 121 | connection_done (void *cls, |
122 | struct MHD_Connection *connection, | 122 | struct MHD_Connection *connection, |
123 | void **con_cls, | 123 | void **req_cls, |
124 | enum MHD_RequestTerminationCode toe) | 124 | enum MHD_RequestTerminationCode toe) |
125 | { | 125 | { |
126 | struct Request *req = *con_cls; | 126 | struct Request *req = *req_cls; |
127 | 127 | ||
128 | (void) cls; | 128 | (void) cls; |
129 | (void) connection; | 129 | (void) connection; |
diff --git a/src/examples/timeout.c b/src/examples/timeout.c index b31ff21f..b52f508f 100644 --- a/src/examples/timeout.c +++ b/src/examples/timeout.c | |||
@@ -37,7 +37,7 @@ answer_to_connection (void *cls, | |||
37 | const char *version, | 37 | const char *version, |
38 | const char *upload_data, | 38 | const char *upload_data, |
39 | size_t *upload_data_size, | 39 | size_t *upload_data_size, |
40 | void **con_cls) | 40 | void **req_cls) |
41 | { | 41 | { |
42 | const char *page = "<html><body>Hello timeout!</body></html>"; | 42 | const char *page = "<html><body>Hello timeout!</body></html>"; |
43 | struct MHD_Response *response; | 43 | struct MHD_Response *response; |
@@ -48,7 +48,7 @@ answer_to_connection (void *cls, | |||
48 | (void) method; /* Unused. Silent compiler warning. */ | 48 | (void) method; /* Unused. Silent compiler warning. */ |
49 | (void) upload_data; /* Unused. Silent compiler warning. */ | 49 | (void) upload_data; /* Unused. Silent compiler warning. */ |
50 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 50 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
51 | (void) con_cls; /* Unused. Silent compiler warning. */ | 51 | (void) req_cls; /* Unused. Silent compiler warning. */ |
52 | 52 | ||
53 | response = MHD_create_response_from_buffer (strlen (page), | 53 | response = MHD_create_response_from_buffer (strlen (page), |
54 | (void *) page, | 54 | (void *) page, |
diff --git a/src/examples/upgrade_example.c b/src/examples/upgrade_example.c index 08c718d0..547f1b6c 100644 --- a/src/examples/upgrade_example.c +++ b/src/examples/upgrade_example.c | |||
@@ -169,7 +169,7 @@ run_usock (void *cls) | |||
169 | * @param connection original HTTP connection handle, | 169 | * @param connection original HTTP connection handle, |
170 | * giving the function a last chance | 170 | * giving the function a last chance |
171 | * to inspect the original HTTP request | 171 | * to inspect the original HTTP request |
172 | * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` | 172 | * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` |
173 | * @param extra_in if we happened to have read bytes after the | 173 | * @param extra_in if we happened to have read bytes after the |
174 | * HTTP header already (because the client sent | 174 | * HTTP header already (because the client sent |
175 | * more than the HTTP header of the request before | 175 | * more than the HTTP header of the request before |
@@ -194,7 +194,7 @@ run_usock (void *cls) | |||
194 | static void | 194 | static void |
195 | uh_cb (void *cls, | 195 | uh_cb (void *cls, |
196 | struct MHD_Connection *connection, | 196 | struct MHD_Connection *connection, |
197 | void *con_cls, | 197 | void *req_cls, |
198 | const char *extra_in, | 198 | const char *extra_in, |
199 | size_t extra_in_size, | 199 | size_t extra_in_size, |
200 | MHD_socket sock, | 200 | MHD_socket sock, |
@@ -204,7 +204,7 @@ uh_cb (void *cls, | |||
204 | pthread_t pt; | 204 | pthread_t pt; |
205 | (void) cls; /* Unused. Silent compiler warning. */ | 205 | (void) cls; /* Unused. Silent compiler warning. */ |
206 | (void) connection; /* Unused. Silent compiler warning. */ | 206 | (void) connection; /* Unused. Silent compiler warning. */ |
207 | (void) con_cls; /* Unused. Silent compiler warning. */ | 207 | (void) req_cls; /* Unused. Silent compiler warning. */ |
208 | 208 | ||
209 | md = malloc (sizeof (struct MyData)); | 209 | md = malloc (sizeof (struct MyData)); |
210 | if (NULL == md) | 210 | if (NULL == md) |
@@ -247,7 +247,7 @@ ahc_echo (void *cls, | |||
247 | const char *version, | 247 | const char *version, |
248 | const char *upload_data, | 248 | const char *upload_data, |
249 | size_t *upload_data_size, | 249 | size_t *upload_data_size, |
250 | void **ptr) | 250 | void **req_cls) |
251 | { | 251 | { |
252 | static int aptr; | 252 | static int aptr; |
253 | struct MHD_Response *response; | 253 | struct MHD_Response *response; |
@@ -260,13 +260,13 @@ ahc_echo (void *cls, | |||
260 | 260 | ||
261 | if (0 != strcmp (method, "GET")) | 261 | if (0 != strcmp (method, "GET")) |
262 | return MHD_NO; /* unexpected method */ | 262 | return MHD_NO; /* unexpected method */ |
263 | if (&aptr != *ptr) | 263 | if (&aptr != *req_cls) |
264 | { | 264 | { |
265 | /* do never respond on first call */ | 265 | /* do never respond on first call */ |
266 | *ptr = &aptr; | 266 | *req_cls = &aptr; |
267 | return MHD_YES; | 267 | return MHD_YES; |
268 | } | 268 | } |
269 | *ptr = NULL; /* reset when done */ | 269 | *req_cls = NULL; /* reset when done */ |
270 | response = MHD_create_response_for_upgrade (&uh_cb, | 270 | response = MHD_create_response_for_upgrade (&uh_cb, |
271 | NULL); | 271 | NULL); |
272 | 272 | ||
diff --git a/src/examples/websocket_chatserver_example.c b/src/examples/websocket_chatserver_example.c index 0c39d5f0..052b4221 100644 --- a/src/examples/websocket_chatserver_example.c +++ b/src/examples/websocket_chatserver_example.c | |||
@@ -2044,7 +2044,7 @@ connecteduser_receive_messages (void *cls) | |||
2044 | * @param connection original HTTP connection handle, | 2044 | * @param connection original HTTP connection handle, |
2045 | * giving the function a last chance | 2045 | * giving the function a last chance |
2046 | * to inspect the original HTTP request | 2046 | * to inspect the original HTTP request |
2047 | * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` | 2047 | * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` |
2048 | * @param extra_in if we happened to have read bytes after the | 2048 | * @param extra_in if we happened to have read bytes after the |
2049 | * HTTP header already (because the client sent | 2049 | * HTTP header already (because the client sent |
2050 | * more than the HTTP header of the request before | 2050 | * more than the HTTP header of the request before |
@@ -2069,7 +2069,7 @@ connecteduser_receive_messages (void *cls) | |||
2069 | static void | 2069 | static void |
2070 | upgrade_handler (void *cls, | 2070 | upgrade_handler (void *cls, |
2071 | struct MHD_Connection *connection, | 2071 | struct MHD_Connection *connection, |
2072 | void *con_cls, | 2072 | void *req_cls, |
2073 | const char *extra_in, | 2073 | const char *extra_in, |
2074 | size_t extra_in_size, | 2074 | size_t extra_in_size, |
2075 | MHD_socket fd, | 2075 | MHD_socket fd, |
@@ -2079,7 +2079,7 @@ upgrade_handler (void *cls, | |||
2079 | pthread_t pt; | 2079 | pthread_t pt; |
2080 | (void) cls; /* Unused. Silent compiler warning. */ | 2080 | (void) cls; /* Unused. Silent compiler warning. */ |
2081 | (void) connection; /* Unused. Silent compiler warning. */ | 2081 | (void) connection; /* Unused. Silent compiler warning. */ |
2082 | (void) con_cls; /* Unused. Silent compiler warning. */ | 2082 | (void) req_cls; /* Unused. Silent compiler warning. */ |
2083 | 2083 | ||
2084 | /* This callback must return as soon as possible. */ | 2084 | /* This callback must return as soon as possible. */ |
2085 | 2085 | ||
@@ -2130,7 +2130,7 @@ upgrade_handler (void *cls, | |||
2130 | * @param version The HTTP version | 2130 | * @param version The HTTP version |
2131 | * @param upload_data Given upload data for POST requests | 2131 | * @param upload_data Given upload data for POST requests |
2132 | * @param upload_data_size The size of the upload data | 2132 | * @param upload_data_size The size of the upload data |
2133 | * @param ptr A pointer for request specific data | 2133 | * @param req_cls A pointer for request specific data |
2134 | * @return MHD_YES on success or MHD_NO on error. | 2134 | * @return MHD_YES on success or MHD_NO on error. |
2135 | */ | 2135 | */ |
2136 | static enum MHD_Result | 2136 | static enum MHD_Result |
@@ -2141,7 +2141,7 @@ access_handler (void *cls, | |||
2141 | const char *version, | 2141 | const char *version, |
2142 | const char *upload_data, | 2142 | const char *upload_data, |
2143 | size_t *upload_data_size, | 2143 | size_t *upload_data_size, |
2144 | void **ptr) | 2144 | void **req_cls) |
2145 | { | 2145 | { |
2146 | static int aptr; | 2146 | static int aptr; |
2147 | struct MHD_Response *response; | 2147 | struct MHD_Response *response; |
@@ -2153,13 +2153,13 @@ access_handler (void *cls, | |||
2153 | 2153 | ||
2154 | if (0 != strcmp (method, "GET")) | 2154 | if (0 != strcmp (method, "GET")) |
2155 | return MHD_NO; /* unexpected method */ | 2155 | return MHD_NO; /* unexpected method */ |
2156 | if (&aptr != *ptr) | 2156 | if (&aptr != *req_cls) |
2157 | { | 2157 | { |
2158 | /* do never respond on first call */ | 2158 | /* do never respond on first call */ |
2159 | *ptr = &aptr; | 2159 | *req_cls = &aptr; |
2160 | return MHD_YES; | 2160 | return MHD_YES; |
2161 | } | 2161 | } |
2162 | *ptr = NULL; /* reset when done */ | 2162 | *req_cls = NULL; /* reset when done */ |
2163 | if (0 == strcmp (url, "/")) | 2163 | if (0 == strcmp (url, "/")) |
2164 | { | 2164 | { |
2165 | /* Default page for visiting the server */ | 2165 | /* Default page for visiting the server */ |
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c index b3c7f111..04b972d4 100644 --- a/src/examples/websocket_threaded_example.c +++ b/src/examples/websocket_threaded_example.c | |||
@@ -763,7 +763,7 @@ run_usock (void *cls) | |||
763 | 763 | ||
764 | 764 | ||
765 | static void | 765 | static void |
766 | uh_cb (void *cls, struct MHD_Connection *con, void *con_cls, | 766 | uh_cb (void *cls, struct MHD_Connection *con, void *req_cls, |
767 | const char *extra_in, size_t extra_in_size, MHD_socket sock, | 767 | const char *extra_in, size_t extra_in_size, MHD_socket sock, |
768 | struct MHD_UpgradeResponseHandle *urh) | 768 | struct MHD_UpgradeResponseHandle *urh) |
769 | { | 769 | { |
@@ -774,7 +774,7 @@ uh_cb (void *cls, struct MHD_Connection *con, void *con_cls, | |||
774 | 774 | ||
775 | (void) cls; /* Unused. Silent compiler warning. */ | 775 | (void) cls; /* Unused. Silent compiler warning. */ |
776 | (void) con; /* Unused. Silent compiler warning. */ | 776 | (void) con; /* Unused. Silent compiler warning. */ |
777 | (void) con_cls; /* Unused. Silent compiler warning. */ | 777 | (void) req_cls; /* Unused. Silent compiler warning. */ |
778 | (void) extra_in; /* Unused. Silent compiler warning. */ | 778 | (void) extra_in; /* Unused. Silent compiler warning. */ |
779 | (void) extra_in_size; /* Unused. Silent compiler warning. */ | 779 | (void) extra_in_size; /* Unused. Silent compiler warning. */ |
780 | 780 | ||
@@ -814,7 +814,7 @@ uh_cb (void *cls, struct MHD_Connection *con, void *con_cls, | |||
814 | static enum MHD_Result | 814 | static enum MHD_Result |
815 | ahc_cb (void *cls, struct MHD_Connection *con, const char *url, | 815 | ahc_cb (void *cls, struct MHD_Connection *con, const char *url, |
816 | const char *method, const char *version, const char *upload_data, | 816 | const char *method, const char *version, const char *upload_data, |
817 | size_t *upload_data_size, void **ptr) | 817 | size_t *upload_data_size, void **req_cls) |
818 | { | 818 | { |
819 | struct MHD_Response *res; | 819 | struct MHD_Response *res; |
820 | const char *upg_header; | 820 | const char *upg_header; |
@@ -830,12 +830,12 @@ ahc_cb (void *cls, struct MHD_Connection *con, const char *url, | |||
830 | (void) upload_data; /* Unused. Silent compiler warning. */ | 830 | (void) upload_data; /* Unused. Silent compiler warning. */ |
831 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 831 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
832 | 832 | ||
833 | if (NULL == *ptr) | 833 | if (NULL == *req_cls) |
834 | { | 834 | { |
835 | *ptr = (void *) 1; | 835 | *req_cls = (void *) 1; |
836 | return MHD_YES; | 836 | return MHD_YES; |
837 | } | 837 | } |
838 | *ptr = NULL; | 838 | *req_cls = NULL; |
839 | upg_header = MHD_lookup_connection_value (con, MHD_HEADER_KIND, | 839 | upg_header = MHD_lookup_connection_value (con, MHD_HEADER_KIND, |
840 | MHD_HTTP_HEADER_UPGRADE); | 840 | MHD_HTTP_HEADER_UPGRADE); |
841 | con_header = MHD_lookup_connection_value (con, MHD_HEADER_KIND, | 841 | con_header = MHD_lookup_connection_value (con, MHD_HEADER_KIND, |
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 811b2fc0..87d2f86e 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -1629,12 +1629,12 @@ enum MHD_OPTION | |||
1629 | * void * my_logger(void *cls, const char *uri, struct MHD_Connection *con) | 1629 | * void * my_logger(void *cls, const char *uri, struct MHD_Connection *con) |
1630 | * | 1630 | * |
1631 | * where the return value will be passed as | 1631 | * where the return value will be passed as |
1632 | * (`* con_cls`) in calls to the #MHD_AccessHandlerCallback | 1632 | * (`* req_cls`) in calls to the #MHD_AccessHandlerCallback |
1633 | * when this request is processed later; returning a | 1633 | * when this request is processed later; returning a |
1634 | * value of NULL has no special significance (however, | 1634 | * value of NULL has no special significance (however, |
1635 | * note that if you return non-NULL, you can no longer | 1635 | * note that if you return non-NULL, you can no longer |
1636 | * rely on the first call to the access handler having | 1636 | * rely on the first call to the access handler having |
1637 | * `NULL == *con_cls` on entry;) | 1637 | * `NULL == *req_cls` on entry;) |
1638 | * "cls" will be set to the second argument following | 1638 | * "cls" will be set to the second argument following |
1639 | * #MHD_OPTION_URI_LOG_CALLBACK. Finally, uri will | 1639 | * #MHD_OPTION_URI_LOG_CALLBACK. Finally, uri will |
1640 | * be the 0-terminated URI of the request. | 1640 | * be the 0-terminated URI of the request. |
@@ -2252,10 +2252,10 @@ enum MHD_ConnectionInfoType | |||
2252 | /** | 2252 | /** |
2253 | * Returns the client-specific pointer to a `void *` that was (possibly) | 2253 | * Returns the client-specific pointer to a `void *` that was (possibly) |
2254 | * set during a #MHD_NotifyConnectionCallback when the socket was | 2254 | * set during a #MHD_NotifyConnectionCallback when the socket was |
2255 | * first accepted. Note that this is NOT the same as the "con_cls" | 2255 | * first accepted. |
2256 | * argument of the #MHD_AccessHandlerCallback. The "con_cls" is | 2256 | * Note that this is NOT the same as the "req_cls" argument of |
2257 | * fresh for each HTTP request, while the "socket_context" is fresh | 2257 | * the #MHD_AccessHandlerCallback. The "req_cls" is fresh for each |
2258 | * for each socket. | 2258 | * HTTP request, while the "socket_context" is fresh for each socket. |
2259 | */ | 2259 | */ |
2260 | MHD_CONNECTION_INFO_SOCKET_CONTEXT, | 2260 | MHD_CONNECTION_INFO_SOCKET_CONTEXT, |
2261 | 2261 | ||
@@ -2428,7 +2428,7 @@ typedef enum MHD_Result | |||
2428 | * @param[in,out] upload_data_size set initially to the size of the | 2428 | * @param[in,out] upload_data_size set initially to the size of the |
2429 | * @a upload_data provided; the method must update this | 2429 | * @a upload_data provided; the method must update this |
2430 | * value to the number of bytes NOT processed; | 2430 | * value to the number of bytes NOT processed; |
2431 | * @param[in,out] con_cls pointer that the callback can set to some | 2431 | * @param[in,out] req_cls pointer that the callback can set to some |
2432 | * address and that will be preserved by MHD for future | 2432 | * address and that will be preserved by MHD for future |
2433 | * calls for this request; since the access handler may | 2433 | * calls for this request; since the access handler may |
2434 | * be called many times (i.e., for a PUT/POST operation | 2434 | * be called many times (i.e., for a PUT/POST operation |
@@ -2437,7 +2437,7 @@ typedef enum MHD_Result | |||
2437 | * If necessary, this state can be cleaned up in the | 2437 | * If necessary, this state can be cleaned up in the |
2438 | * global #MHD_RequestCompletedCallback (which | 2438 | * global #MHD_RequestCompletedCallback (which |
2439 | * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). | 2439 | * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). |
2440 | * Initially, `*con_cls` will be NULL. | 2440 | * Initially, `*req_cls` will be NULL. |
2441 | * @return #MHD_YES if the connection was handled successfully, | 2441 | * @return #MHD_YES if the connection was handled successfully, |
2442 | * #MHD_NO if the socket must be closed due to a serious | 2442 | * #MHD_NO if the socket must be closed due to a serious |
2443 | * error while handling the request | 2443 | * error while handling the request |
@@ -2452,7 +2452,7 @@ typedef enum MHD_Result | |||
2452 | const char *version, | 2452 | const char *version, |
2453 | const char *upload_data, | 2453 | const char *upload_data, |
2454 | size_t *upload_data_size, | 2454 | size_t *upload_data_size, |
2455 | void **con_cls); | 2455 | void **req_cls); |
2456 | 2456 | ||
2457 | 2457 | ||
2458 | /** | 2458 | /** |
@@ -2461,7 +2461,7 @@ typedef enum MHD_Result | |||
2461 | * | 2461 | * |
2462 | * @param cls client-defined closure | 2462 | * @param cls client-defined closure |
2463 | * @param connection connection handle | 2463 | * @param connection connection handle |
2464 | * @param con_cls value as set by the last call to | 2464 | * @param req_cls value as set by the last call to |
2465 | * the #MHD_AccessHandlerCallback | 2465 | * the #MHD_AccessHandlerCallback |
2466 | * @param toe reason for request termination | 2466 | * @param toe reason for request termination |
2467 | * @see #MHD_OPTION_NOTIFY_COMPLETED | 2467 | * @see #MHD_OPTION_NOTIFY_COMPLETED |
@@ -2470,7 +2470,7 @@ typedef enum MHD_Result | |||
2470 | typedef void | 2470 | typedef void |
2471 | (*MHD_RequestCompletedCallback) (void *cls, | 2471 | (*MHD_RequestCompletedCallback) (void *cls, |
2472 | struct MHD_Connection *connection, | 2472 | struct MHD_Connection *connection, |
2473 | void **con_cls, | 2473 | void **req_cls, |
2474 | enum MHD_RequestTerminationCode toe); | 2474 | enum MHD_RequestTerminationCode toe); |
2475 | 2475 | ||
2476 | 2476 | ||
@@ -2483,7 +2483,7 @@ typedef void | |||
2483 | * @param socket_context socket-specific pointer where the | 2483 | * @param socket_context socket-specific pointer where the |
2484 | * client can associate some state specific | 2484 | * client can associate some state specific |
2485 | * to the TCP connection; note that this is | 2485 | * to the TCP connection; note that this is |
2486 | * different from the "con_cls" which is per | 2486 | * different from the "req_cls" which is per |
2487 | * HTTP request. The client can initialize | 2487 | * HTTP request. The client can initialize |
2488 | * during #MHD_CONNECTION_NOTIFY_STARTED and | 2488 | * during #MHD_CONNECTION_NOTIFY_STARTED and |
2489 | * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED | 2489 | * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED |
@@ -3790,7 +3790,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, | |||
3790 | * @param connection original HTTP connection handle, | 3790 | * @param connection original HTTP connection handle, |
3791 | * giving the function a last chance | 3791 | * giving the function a last chance |
3792 | * to inspect the original HTTP request | 3792 | * to inspect the original HTTP request |
3793 | * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` | 3793 | * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` |
3794 | * @param extra_in if we happened to have read bytes after the | 3794 | * @param extra_in if we happened to have read bytes after the |
3795 | * HTTP header already (because the client sent | 3795 | * HTTP header already (because the client sent |
3796 | * more than the HTTP header of the request before | 3796 | * more than the HTTP header of the request before |
@@ -3815,7 +3815,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, | |||
3815 | typedef void | 3815 | typedef void |
3816 | (*MHD_UpgradeHandler)(void *cls, | 3816 | (*MHD_UpgradeHandler)(void *cls, |
3817 | struct MHD_Connection *connection, | 3817 | struct MHD_Connection *connection, |
3818 | void *con_cls, | 3818 | void *req_cls, |
3819 | const char *extra_in, | 3819 | const char *extra_in, |
3820 | size_t extra_in_size, | 3820 | size_t extra_in_size, |
3821 | MHD_socket sock, | 3821 | MHD_socket sock, |
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h index 924814f9..5bf125ef 100644 --- a/src/include/microhttpd2.h +++ b/src/include/microhttpd2.h | |||
@@ -2429,7 +2429,7 @@ enum MHD_ConnectionNotificationCode | |||
2429 | * @param socket_context socket-specific pointer where the | 2429 | * @param socket_context socket-specific pointer where the |
2430 | * client can associate some state specific | 2430 | * client can associate some state specific |
2431 | * to the TCP connection; note that this is | 2431 | * to the TCP connection; note that this is |
2432 | * different from the "con_cls" which is per | 2432 | * different from the "req_cls" which is per |
2433 | * HTTP request. The client can initialize | 2433 | * HTTP request. The client can initialize |
2434 | * during #MHD_CONNECTION_NOTIFY_STARTED and | 2434 | * during #MHD_CONNECTION_NOTIFY_STARTED and |
2435 | * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED | 2435 | * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED |
@@ -3303,7 +3303,7 @@ MHD_NONNULL (1); | |||
3303 | * @param connection original HTTP connection handle, | 3303 | * @param connection original HTTP connection handle, |
3304 | * giving the function a last chance | 3304 | * giving the function a last chance |
3305 | * to inspect the original HTTP request | 3305 | * to inspect the original HTTP request |
3306 | * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` | 3306 | * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` |
3307 | * @param extra_in if we happened to have read bytes after the | 3307 | * @param extra_in if we happened to have read bytes after the |
3308 | * HTTP header already (because the client sent | 3308 | * HTTP header already (because the client sent |
3309 | * more than the HTTP header of the request before | 3309 | * more than the HTTP header of the request before |
@@ -3328,7 +3328,7 @@ MHD_NONNULL (1); | |||
3328 | typedef void | 3328 | typedef void |
3329 | (*MHD_UpgradeHandler)(void *cls, | 3329 | (*MHD_UpgradeHandler)(void *cls, |
3330 | struct MHD_Connection *connection, | 3330 | struct MHD_Connection *connection, |
3331 | void *con_cls, | 3331 | void *req_cls, |
3332 | const char *extra_in, | 3332 | const char *extra_in, |
3333 | size_t extra_in_size, | 3333 | size_t extra_in_size, |
3334 | MHD_socket sock, | 3334 | MHD_socket sock, |
@@ -3644,8 +3644,8 @@ enum MHD_ConnectionInformationType | |||
3644 | /** | 3644 | /** |
3645 | * Returns the client-specific pointer to a `void *` that was (possibly) | 3645 | * Returns the client-specific pointer to a `void *` that was (possibly) |
3646 | * set during a #MHD_NotifyConnectionCallback when the socket was | 3646 | * set during a #MHD_NotifyConnectionCallback when the socket was |
3647 | * first accepted. Note that this is NOT the same as the "con_cls" | 3647 | * first accepted. Note that this is NOT the same as the "req_cls" |
3648 | * argument of the #MHD_AccessHandlerCallback. The "con_cls" is | 3648 | * argument of the #MHD_AccessHandlerCallback. The "req_cls" is |
3649 | * fresh for each HTTP request, while the "socket_context" is fresh | 3649 | * fresh for each HTTP request, while the "socket_context" is fresh |
3650 | * for each socket. | 3650 | * for each socket. |
3651 | */ | 3651 | */ |
diff --git a/src/microhttpd/test_client_put_stop.c b/src/microhttpd/test_client_put_stop.c index c1707c5c..6c641e6f 100644 --- a/src/microhttpd/test_client_put_stop.c +++ b/src/microhttpd/test_client_put_stop.c | |||
@@ -1052,12 +1052,12 @@ struct term_notif_cb_param | |||
1052 | static void | 1052 | static void |
1053 | term_cb (void *cls, | 1053 | term_cb (void *cls, |
1054 | struct MHD_Connection *c, | 1054 | struct MHD_Connection *c, |
1055 | void **con_cls, | 1055 | void **req_cls, |
1056 | enum MHD_RequestTerminationCode term_code) | 1056 | enum MHD_RequestTerminationCode term_code) |
1057 | { | 1057 | { |
1058 | struct term_notif_cb_param *param = (struct term_notif_cb_param *) cls; | 1058 | struct term_notif_cb_param *param = (struct term_notif_cb_param *) cls; |
1059 | if (NULL == con_cls) | 1059 | if (NULL == req_cls) |
1060 | mhdErrorExitDesc ("'con_cls' pointer is NULL"); | 1060 | mhdErrorExitDesc ("'req_cls' pointer is NULL"); |
1061 | if (NULL == c) | 1061 | if (NULL == c) |
1062 | mhdErrorExitDesc ("'connection' pointer is NULL"); | 1062 | mhdErrorExitDesc ("'connection' pointer is NULL"); |
1063 | if (NULL == param) | 1063 | if (NULL == param) |
@@ -1220,7 +1220,7 @@ ahcCheck (void *cls, | |||
1220 | const char *method, | 1220 | const char *method, |
1221 | const char *version, | 1221 | const char *version, |
1222 | const char *upload_data, size_t *upload_data_size, | 1222 | const char *upload_data, size_t *upload_data_size, |
1223 | void **con_cls) | 1223 | void **req_cls) |
1224 | { | 1224 | { |
1225 | static int marker; | 1225 | static int marker; |
1226 | enum MHD_Result ret; | 1226 | enum MHD_Result ret; |
@@ -1273,13 +1273,13 @@ ahcCheck (void *cls, | |||
1273 | *upload_data_size = 0; | 1273 | *upload_data_size = 0; |
1274 | } | 1274 | } |
1275 | 1275 | ||
1276 | if (&marker != *con_cls) | 1276 | if (&marker != *req_cls) |
1277 | { | 1277 | { |
1278 | /* The first call of the callback for this connection */ | 1278 | /* The first call of the callback for this connection */ |
1279 | mhd_assert (NULL == upload_data); | 1279 | mhd_assert (NULL == upload_data); |
1280 | param->req_body_uploaded = 0; | 1280 | param->req_body_uploaded = 0; |
1281 | 1281 | ||
1282 | *con_cls = ▮ | 1282 | *req_cls = ▮ |
1283 | return MHD_YES; | 1283 | return MHD_YES; |
1284 | } | 1284 | } |
1285 | 1285 | ||
diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c index 14a77832..7a55ff65 100644 --- a/src/microhttpd/test_daemon.c +++ b/src/microhttpd/test_daemon.c | |||
@@ -81,11 +81,11 @@ ahc_nothing (void *cls, | |||
81 | const char *method, | 81 | const char *method, |
82 | const char *version, | 82 | const char *version, |
83 | const char *upload_data, size_t *upload_data_size, | 83 | const char *upload_data, size_t *upload_data_size, |
84 | void **unused) | 84 | void **req_cls) |
85 | { | 85 | { |
86 | (void) cls; (void) connection; (void) url; /* Unused. Silent compiler warning. */ | 86 | (void) cls; (void) connection; (void) url; /* Unused. Silent compiler warning. */ |
87 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 87 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
88 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 88 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
89 | 89 | ||
90 | return MHD_NO; | 90 | return MHD_NO; |
91 | } | 91 | } |
diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c index 575b6a2b..b79ddb01 100644 --- a/src/microhttpd/test_options.c +++ b/src/microhttpd/test_options.c | |||
@@ -42,7 +42,7 @@ ahc_echo (void *cls, | |||
42 | const char *method, | 42 | const char *method, |
43 | const char *version, | 43 | const char *version, |
44 | const char *upload_data, size_t *upload_data_size, | 44 | const char *upload_data, size_t *upload_data_size, |
45 | void **unused) | 45 | void **req_cls) |
46 | { | 46 | { |
47 | (void) cls; | 47 | (void) cls; |
48 | (void) connection; | 48 | (void) connection; |
@@ -51,7 +51,7 @@ ahc_echo (void *cls, | |||
51 | (void) version; | 51 | (void) version; |
52 | (void) upload_data; | 52 | (void) upload_data; |
53 | (void) upload_data_size; | 53 | (void) upload_data_size; |
54 | (void) unused; | 54 | (void) req_cls; |
55 | 55 | ||
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c index db2d0684..34372090 100644 --- a/src/microhttpd/test_start_stop.c +++ b/src/microhttpd/test_start_stop.c | |||
@@ -42,11 +42,11 @@ ahc_echo (void *cls, | |||
42 | const char *method, | 42 | const char *method, |
43 | const char *version, | 43 | const char *version, |
44 | const char *upload_data, size_t *upload_data_size, | 44 | const char *upload_data, size_t *upload_data_size, |
45 | void **unused) | 45 | void **req_cls) |
46 | { | 46 | { |
47 | (void) cls; (void) connection; (void) url; /* Unused. Silent compiler warning. */ | 47 | (void) cls; (void) connection; (void) url; /* Unused. Silent compiler warning. */ |
48 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 48 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
49 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 49 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
50 | 50 | ||
51 | return MHD_NO; | 51 | return MHD_NO; |
52 | } | 52 | } |
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c index fa91f7dc..0bbb08e9 100644 --- a/src/microhttpd/test_upgrade.c +++ b/src/microhttpd/test_upgrade.c | |||
@@ -628,14 +628,14 @@ term_reason_str (enum MHD_RequestTerminationCode term_code) | |||
628 | * | 628 | * |
629 | * @param cls client-defined closure | 629 | * @param cls client-defined closure |
630 | * @param connection connection handle | 630 | * @param connection connection handle |
631 | * @param con_cls value as set by the last call to | 631 | * @param req_cls value as set by the last call to |
632 | * the #MHD_AccessHandlerCallback | 632 | * the #MHD_AccessHandlerCallback |
633 | * @param toe reason for request termination | 633 | * @param toe reason for request termination |
634 | */ | 634 | */ |
635 | static void | 635 | static void |
636 | notify_completed_cb (void *cls, | 636 | notify_completed_cb (void *cls, |
637 | struct MHD_Connection *connection, | 637 | struct MHD_Connection *connection, |
638 | void **con_cls, | 638 | void **req_cls, |
639 | enum MHD_RequestTerminationCode toe) | 639 | enum MHD_RequestTerminationCode toe) |
640 | { | 640 | { |
641 | (void) cls; | 641 | (void) cls; |
@@ -647,15 +647,15 @@ notify_completed_cb (void *cls, | |||
647 | (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && | 647 | (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && |
648 | (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) | 648 | (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) |
649 | mhdErrorExitDesc ("notify_completed_cb() called with wrong code"); | 649 | mhdErrorExitDesc ("notify_completed_cb() called with wrong code"); |
650 | if (NULL == con_cls) | 650 | if (NULL == req_cls) |
651 | mhdErrorExitDesc ("'con_cls' parameter is NULL"); | 651 | mhdErrorExitDesc ("'req_cls' parameter is NULL"); |
652 | if (NULL == *con_cls) | 652 | if (NULL == *req_cls) |
653 | mhdErrorExitDesc ("'*con_cls' pointer is NULL"); | 653 | mhdErrorExitDesc ("'*req_cls' pointer is NULL"); |
654 | if (! pthread_equal (**((pthread_t **) con_cls), | 654 | if (! pthread_equal (**((pthread_t **) req_cls), |
655 | pthread_self ())) | 655 | pthread_self ())) |
656 | mhdErrorExitDesc ("notify_completed_cb() is called in wrong thread"); | 656 | mhdErrorExitDesc ("notify_completed_cb() is called in wrong thread"); |
657 | free (*con_cls); | 657 | free (*req_cls); |
658 | *con_cls = NULL; | 658 | *req_cls = NULL; |
659 | } | 659 | } |
660 | 660 | ||
661 | 661 | ||
@@ -700,7 +700,7 @@ log_cb (void *cls, | |||
700 | * @param socket_context socket-specific pointer where the | 700 | * @param socket_context socket-specific pointer where the |
701 | * client can associate some state specific | 701 | * client can associate some state specific |
702 | * to the TCP connection; note that this is | 702 | * to the TCP connection; note that this is |
703 | * different from the "con_cls" which is per | 703 | * different from the "req_cls" which is per |
704 | * HTTP request. The client can initialize | 704 | * HTTP request. The client can initialize |
705 | * during #MHD_CONNECTION_NOTIFY_STARTED and | 705 | * during #MHD_CONNECTION_NOTIFY_STARTED and |
706 | * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED | 706 | * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED |
@@ -956,7 +956,7 @@ run_usock_client (void *cls) | |||
956 | * @param connection original HTTP connection handle, | 956 | * @param connection original HTTP connection handle, |
957 | * giving the function a last chance | 957 | * giving the function a last chance |
958 | * to inspect the original HTTP request | 958 | * to inspect the original HTTP request |
959 | * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` | 959 | * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` |
960 | * @param extra_in if we happened to have read bytes after the | 960 | * @param extra_in if we happened to have read bytes after the |
961 | * HTTP header already (because the client sent | 961 | * HTTP header already (because the client sent |
962 | * more than the HTTP header of the request before | 962 | * more than the HTTP header of the request before |
@@ -981,7 +981,7 @@ run_usock_client (void *cls) | |||
981 | static void | 981 | static void |
982 | upgrade_cb (void *cls, | 982 | upgrade_cb (void *cls, |
983 | struct MHD_Connection *connection, | 983 | struct MHD_Connection *connection, |
984 | void *con_cls, | 984 | void *req_cls, |
985 | const char *extra_in, | 985 | const char *extra_in, |
986 | size_t extra_in_size, | 986 | size_t extra_in_size, |
987 | MHD_socket sock, | 987 | MHD_socket sock, |
@@ -989,7 +989,7 @@ upgrade_cb (void *cls, | |||
989 | { | 989 | { |
990 | (void) cls; | 990 | (void) cls; |
991 | (void) connection; | 991 | (void) connection; |
992 | (void) con_cls; | 992 | (void) req_cls; |
993 | (void) extra_in; /* Unused. Silent compiler warning. */ | 993 | (void) extra_in; /* Unused. Silent compiler warning. */ |
994 | 994 | ||
995 | usock = wr_create_from_plain_sckt (sock); | 995 | usock = wr_create_from_plain_sckt (sock); |
@@ -1028,7 +1028,7 @@ upgrade_cb (void *cls, | |||
1028 | * @param upload_data_size set initially to the size of the | 1028 | * @param upload_data_size set initially to the size of the |
1029 | * @a upload_data provided; the method must update this | 1029 | * @a upload_data provided; the method must update this |
1030 | * value to the number of bytes NOT processed; | 1030 | * value to the number of bytes NOT processed; |
1031 | * @param con_cls pointer that the callback can set to some | 1031 | * @param req_cls pointer that the callback can set to some |
1032 | * address and that will be preserved by MHD for future | 1032 | * address and that will be preserved by MHD for future |
1033 | * calls for this request; since the access handler may | 1033 | * calls for this request; since the access handler may |
1034 | * be called many times (i.e., for a PUT/POST operation | 1034 | * be called many times (i.e., for a PUT/POST operation |
@@ -1037,7 +1037,7 @@ upgrade_cb (void *cls, | |||
1037 | * If necessary, this state can be cleaned up in the | 1037 | * If necessary, this state can be cleaned up in the |
1038 | * global #MHD_RequestCompletedCallback (which | 1038 | * global #MHD_RequestCompletedCallback (which |
1039 | * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). | 1039 | * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). |
1040 | * Initially, `*con_cls` will be NULL. | 1040 | * Initially, `*req_cls` will be NULL. |
1041 | * @return #MHD_YES if the connection was handled successfully, | 1041 | * @return #MHD_YES if the connection was handled successfully, |
1042 | * #MHD_NO if the socket must be closed due to a serious | 1042 | * #MHD_NO if the socket must be closed due to a serious |
1043 | * error while handling the request | 1043 | * error while handling the request |
@@ -1050,7 +1050,7 @@ ahc_upgrade (void *cls, | |||
1050 | const char *version, | 1050 | const char *version, |
1051 | const char *upload_data, | 1051 | const char *upload_data, |
1052 | size_t *upload_data_size, | 1052 | size_t *upload_data_size, |
1053 | void **con_cls) | 1053 | void **req_cls) |
1054 | { | 1054 | { |
1055 | struct MHD_Response *resp; | 1055 | struct MHD_Response *resp; |
1056 | (void) cls; | 1056 | (void) cls; |
@@ -1060,11 +1060,11 @@ ahc_upgrade (void *cls, | |||
1060 | (void) upload_data; | 1060 | (void) upload_data; |
1061 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 1061 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
1062 | 1062 | ||
1063 | if (NULL == con_cls) | 1063 | if (NULL == req_cls) |
1064 | mhdErrorExitDesc ("'con_cls' is NULL"); | 1064 | mhdErrorExitDesc ("'req_cls' is NULL"); |
1065 | if (NULL == *con_cls) | 1065 | if (NULL == *req_cls) |
1066 | mhdErrorExitDesc ("'*con_cls' value is NULL"); | 1066 | mhdErrorExitDesc ("'*req_cls' value is NULL"); |
1067 | if (! pthread_equal (**((pthread_t **) con_cls), pthread_self ())) | 1067 | if (! pthread_equal (**((pthread_t **) req_cls), pthread_self ())) |
1068 | mhdErrorExitDesc ("ahc_upgrade() is called in wrong thread"); | 1068 | mhdErrorExitDesc ("ahc_upgrade() is called in wrong thread"); |
1069 | resp = MHD_create_response_for_upgrade (&upgrade_cb, | 1069 | resp = MHD_create_response_for_upgrade (&upgrade_cb, |
1070 | NULL); | 1070 | NULL); |
diff --git a/src/microhttpd/test_upgrade_large.c b/src/microhttpd/test_upgrade_large.c index 3ccb1985..1928080d 100644 --- a/src/microhttpd/test_upgrade_large.c +++ b/src/microhttpd/test_upgrade_large.c | |||
@@ -796,14 +796,14 @@ term_reason_str (enum MHD_RequestTerminationCode term_code) | |||
796 | * | 796 | * |
797 | * @param cls client-defined closure | 797 | * @param cls client-defined closure |
798 | * @param connection connection handle | 798 | * @param connection connection handle |
799 | * @param con_cls value as set by the last call to | 799 | * @param req_cls value as set by the last call to |
800 | * the #MHD_AccessHandlerCallback | 800 | * the #MHD_AccessHandlerCallback |
801 | * @param toe reason for request termination | 801 | * @param toe reason for request termination |
802 | */ | 802 | */ |
803 | static void | 803 | static void |
804 | notify_completed_cb (void *cls, | 804 | notify_completed_cb (void *cls, |
805 | struct MHD_Connection *connection, | 805 | struct MHD_Connection *connection, |
806 | void **con_cls, | 806 | void **req_cls, |
807 | enum MHD_RequestTerminationCode toe) | 807 | enum MHD_RequestTerminationCode toe) |
808 | { | 808 | { |
809 | (void) cls; | 809 | (void) cls; |
@@ -815,15 +815,15 @@ notify_completed_cb (void *cls, | |||
815 | (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && | 815 | (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && |
816 | (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) | 816 | (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) |
817 | mhdErrorExitDesc ("notify_completed_cb() called with wrong code"); | 817 | mhdErrorExitDesc ("notify_completed_cb() called with wrong code"); |
818 | if (NULL == con_cls) | 818 | if (NULL == req_cls) |
819 | mhdErrorExitDesc ("'con_cls' parameter is NULL"); | 819 | mhdErrorExitDesc ("'req_cls' parameter is NULL"); |
820 | if (NULL == *con_cls) | 820 | if (NULL == *req_cls) |
821 | mhdErrorExitDesc ("'*con_cls' pointer is NULL"); | 821 | mhdErrorExitDesc ("'*req_cls' pointer is NULL"); |
822 | if (! pthread_equal (**((pthread_t **) con_cls), | 822 | if (! pthread_equal (**((pthread_t **) req_cls), |
823 | pthread_self ())) | 823 | pthread_self ())) |
824 | mhdErrorExitDesc ("notify_completed_cb() is called in wrong thread"); | 824 | mhdErrorExitDesc ("notify_completed_cb() is called in wrong thread"); |
825 | free (*con_cls); | 825 | free (*req_cls); |
826 | *con_cls = NULL; | 826 | *req_cls = NULL; |
827 | } | 827 | } |
828 | 828 | ||
829 | 829 | ||
@@ -868,7 +868,7 @@ log_cb (void *cls, | |||
868 | * @param socket_context socket-specific pointer where the | 868 | * @param socket_context socket-specific pointer where the |
869 | * client can associate some state specific | 869 | * client can associate some state specific |
870 | * to the TCP connection; note that this is | 870 | * to the TCP connection; note that this is |
871 | * different from the "con_cls" which is per | 871 | * different from the "req_cls" which is per |
872 | * HTTP request. The client can initialize | 872 | * HTTP request. The client can initialize |
873 | * during #MHD_CONNECTION_NOTIFY_STARTED and | 873 | * during #MHD_CONNECTION_NOTIFY_STARTED and |
874 | * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED | 874 | * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED |
@@ -1139,7 +1139,7 @@ run_usock_client (void *cls) | |||
1139 | * @param connection original HTTP connection handle, | 1139 | * @param connection original HTTP connection handle, |
1140 | * giving the function a last chance | 1140 | * giving the function a last chance |
1141 | * to inspect the original HTTP request | 1141 | * to inspect the original HTTP request |
1142 | * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` | 1142 | * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` |
1143 | * @param extra_in if we happened to have read bytes after the | 1143 | * @param extra_in if we happened to have read bytes after the |
1144 | * HTTP header already (because the client sent | 1144 | * HTTP header already (because the client sent |
1145 | * more than the HTTP header of the request before | 1145 | * more than the HTTP header of the request before |
@@ -1164,7 +1164,7 @@ run_usock_client (void *cls) | |||
1164 | static void | 1164 | static void |
1165 | upgrade_cb (void *cls, | 1165 | upgrade_cb (void *cls, |
1166 | struct MHD_Connection *connection, | 1166 | struct MHD_Connection *connection, |
1167 | void *con_cls, | 1167 | void *req_cls, |
1168 | const char *extra_in, | 1168 | const char *extra_in, |
1169 | size_t extra_in_size, | 1169 | size_t extra_in_size, |
1170 | MHD_socket sock, | 1170 | MHD_socket sock, |
@@ -1172,7 +1172,7 @@ upgrade_cb (void *cls, | |||
1172 | { | 1172 | { |
1173 | (void) cls; | 1173 | (void) cls; |
1174 | (void) connection; | 1174 | (void) connection; |
1175 | (void) con_cls; | 1175 | (void) req_cls; |
1176 | (void) extra_in; /* Unused. Silent compiler warning. */ | 1176 | (void) extra_in; /* Unused. Silent compiler warning. */ |
1177 | 1177 | ||
1178 | usock = wr_create_from_plain_sckt (sock); | 1178 | usock = wr_create_from_plain_sckt (sock); |
@@ -1211,7 +1211,7 @@ upgrade_cb (void *cls, | |||
1211 | * @param upload_data_size set initially to the size of the | 1211 | * @param upload_data_size set initially to the size of the |
1212 | * @a upload_data provided; the method must update this | 1212 | * @a upload_data provided; the method must update this |
1213 | * value to the number of bytes NOT processed; | 1213 | * value to the number of bytes NOT processed; |
1214 | * @param con_cls pointer that the callback can set to some | 1214 | * @param req_cls pointer that the callback can set to some |
1215 | * address and that will be preserved by MHD for future | 1215 | * address and that will be preserved by MHD for future |
1216 | * calls for this request; since the access handler may | 1216 | * calls for this request; since the access handler may |
1217 | * be called many times (i.e., for a PUT/POST operation | 1217 | * be called many times (i.e., for a PUT/POST operation |
@@ -1220,7 +1220,7 @@ upgrade_cb (void *cls, | |||
1220 | * If necessary, this state can be cleaned up in the | 1220 | * If necessary, this state can be cleaned up in the |
1221 | * global #MHD_RequestCompletedCallback (which | 1221 | * global #MHD_RequestCompletedCallback (which |
1222 | * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). | 1222 | * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). |
1223 | * Initially, `*con_cls` will be NULL. | 1223 | * Initially, `*req_cls` will be NULL. |
1224 | * @return #MHD_YES if the connection was handled successfully, | 1224 | * @return #MHD_YES if the connection was handled successfully, |
1225 | * #MHD_NO if the socket must be closed due to a serious | 1225 | * #MHD_NO if the socket must be closed due to a serious |
1226 | * error while handling the request | 1226 | * error while handling the request |
@@ -1233,7 +1233,7 @@ ahc_upgrade (void *cls, | |||
1233 | const char *version, | 1233 | const char *version, |
1234 | const char *upload_data, | 1234 | const char *upload_data, |
1235 | size_t *upload_data_size, | 1235 | size_t *upload_data_size, |
1236 | void **con_cls) | 1236 | void **req_cls) |
1237 | { | 1237 | { |
1238 | struct MHD_Response *resp; | 1238 | struct MHD_Response *resp; |
1239 | (void) cls; | 1239 | (void) cls; |
@@ -1243,11 +1243,11 @@ ahc_upgrade (void *cls, | |||
1243 | (void) upload_data; | 1243 | (void) upload_data; |
1244 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 1244 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
1245 | 1245 | ||
1246 | if (NULL == con_cls) | 1246 | if (NULL == req_cls) |
1247 | mhdErrorExitDesc ("'con_cls' is NULL"); | 1247 | mhdErrorExitDesc ("'req_cls' is NULL"); |
1248 | if (NULL == *con_cls) | 1248 | if (NULL == *req_cls) |
1249 | mhdErrorExitDesc ("'*con_cls' value is NULL"); | 1249 | mhdErrorExitDesc ("'*req_cls' value is NULL"); |
1250 | if (! pthread_equal (**((pthread_t **) con_cls), pthread_self ())) | 1250 | if (! pthread_equal (**((pthread_t **) req_cls), pthread_self ())) |
1251 | mhdErrorExitDesc ("ahc_upgrade() is called in wrong thread"); | 1251 | mhdErrorExitDesc ("ahc_upgrade() is called in wrong thread"); |
1252 | resp = MHD_create_response_for_upgrade (&upgrade_cb, | 1252 | resp = MHD_create_response_for_upgrade (&upgrade_cb, |
1253 | NULL); | 1253 | NULL); |
diff --git a/src/microhttpd_ws/test_websocket_browser.c b/src/microhttpd_ws/test_websocket_browser.c index 72354257..96e7755f 100644 --- a/src/microhttpd_ws/test_websocket_browser.c +++ b/src/microhttpd_ws/test_websocket_browser.c | |||
@@ -194,7 +194,7 @@ make_blocking (MHD_socket fd); | |||
194 | static void | 194 | static void |
195 | upgrade_handler (void *cls, | 195 | upgrade_handler (void *cls, |
196 | struct MHD_Connection *connection, | 196 | struct MHD_Connection *connection, |
197 | void *con_cls, | 197 | void *req_cls, |
198 | const char *extra_in, | 198 | const char *extra_in, |
199 | size_t extra_in_size, | 199 | size_t extra_in_size, |
200 | MHD_socket fd, | 200 | MHD_socket fd, |
@@ -404,7 +404,7 @@ access_handler (void *cls, | |||
404 | const char *version, | 404 | const char *version, |
405 | const char *upload_data, | 405 | const char *upload_data, |
406 | size_t *upload_data_size, | 406 | size_t *upload_data_size, |
407 | void **ptr) | 407 | void **req_cls) |
408 | { | 408 | { |
409 | static int aptr; | 409 | static int aptr; |
410 | struct MHD_Response *response; | 410 | struct MHD_Response *response; |
@@ -416,13 +416,13 @@ access_handler (void *cls, | |||
416 | 416 | ||
417 | if (0 != strcmp (method, "GET")) | 417 | if (0 != strcmp (method, "GET")) |
418 | return MHD_NO; /* unexpected method */ | 418 | return MHD_NO; /* unexpected method */ |
419 | if (&aptr != *ptr) | 419 | if (&aptr != *req_cls) |
420 | { | 420 | { |
421 | /* do never respond on first call */ | 421 | /* do never respond on first call */ |
422 | *ptr = &aptr; | 422 | *req_cls = &aptr; |
423 | return MHD_YES; | 423 | return MHD_YES; |
424 | } | 424 | } |
425 | *ptr = NULL; /* reset when done */ | 425 | *req_cls = NULL; /* reset when done */ |
426 | 426 | ||
427 | if (0 == strcmp (url, "/")) | 427 | if (0 == strcmp (url, "/")) |
428 | { | 428 | { |
diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c index 1a466dd7..c2dcf300 100644 --- a/src/testcurl/https/test_empty_response.c +++ b/src/testcurl/https/test_empty_response.c | |||
@@ -45,12 +45,12 @@ ahc_echo (void *cls, | |||
45 | const char *method, | 45 | const char *method, |
46 | const char *version, | 46 | const char *version, |
47 | const char *upload_data, size_t *upload_data_size, | 47 | const char *upload_data, size_t *upload_data_size, |
48 | void **unused) | 48 | void **req_cls) |
49 | { | 49 | { |
50 | struct MHD_Response *response; | 50 | struct MHD_Response *response; |
51 | enum MHD_Result ret; | 51 | enum MHD_Result ret; |
52 | (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ | 52 | (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ |
53 | (void) upload_data; (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 53 | (void) upload_data; (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
54 | 54 | ||
55 | response = MHD_create_response_from_buffer (0, NULL, | 55 | response = MHD_create_response_from_buffer (0, NULL, |
56 | MHD_RESPMEM_PERSISTENT); | 56 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c index 503191e0..968a0b96 100644 --- a/src/testcurl/https/test_https_get.c +++ b/src/testcurl/https/test_https_get.c | |||
@@ -99,7 +99,7 @@ ahc_empty (void *cls, | |||
99 | const char *version, | 99 | const char *version, |
100 | const char *upload_data, | 100 | const char *upload_data, |
101 | size_t *upload_data_size, | 101 | size_t *upload_data_size, |
102 | void **unused) | 102 | void **req_cls) |
103 | { | 103 | { |
104 | static int ptr; | 104 | static int ptr; |
105 | struct MHD_Response *response; | 105 | struct MHD_Response *response; |
@@ -114,12 +114,12 @@ ahc_empty (void *cls, | |||
114 | if (0 != strcmp ("GET", | 114 | if (0 != strcmp ("GET", |
115 | method)) | 115 | method)) |
116 | return MHD_NO; /* unexpected method */ | 116 | return MHD_NO; /* unexpected method */ |
117 | if (&ptr != *unused) | 117 | if (&ptr != *req_cls) |
118 | { | 118 | { |
119 | *unused = &ptr; | 119 | *req_cls = &ptr; |
120 | return MHD_YES; | 120 | return MHD_YES; |
121 | } | 121 | } |
122 | *unused = NULL; | 122 | *req_cls = NULL; |
123 | response = MHD_create_response_from_buffer (0, | 123 | response = MHD_create_response_from_buffer (0, |
124 | NULL, | 124 | NULL, |
125 | MHD_RESPMEM_PERSISTENT); | 125 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/testcurl/https/test_https_get_iovec.c b/src/testcurl/https/test_https_get_iovec.c index 615ef340..3bdb610f 100644 --- a/src/testcurl/https/test_https_get_iovec.c +++ b/src/testcurl/https/test_https_get_iovec.c | |||
@@ -91,7 +91,7 @@ iovec_ahc (void *cls, | |||
91 | const char *version, | 91 | const char *version, |
92 | const char *upload_data, | 92 | const char *upload_data, |
93 | size_t *upload_data_size, | 93 | size_t *upload_data_size, |
94 | void **ptr) | 94 | void **req_cls) |
95 | { | 95 | { |
96 | static int aptr; | 96 | static int aptr; |
97 | struct MHD_Response *response; | 97 | struct MHD_Response *response; |
@@ -105,13 +105,13 @@ iovec_ahc (void *cls, | |||
105 | 105 | ||
106 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) | 106 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) |
107 | return MHD_NO; /* unexpected method */ | 107 | return MHD_NO; /* unexpected method */ |
108 | if (&aptr != *ptr) | 108 | if (&aptr != *req_cls) |
109 | { | 109 | { |
110 | /* do never respond on first call */ | 110 | /* do never respond on first call */ |
111 | *ptr = &aptr; | 111 | *req_cls = &aptr; |
112 | return MHD_YES; | 112 | return MHD_YES; |
113 | } | 113 | } |
114 | *ptr = NULL; /* reset when done */ | 114 | *req_cls = NULL; /* reset when done */ |
115 | 115 | ||
116 | /* Create some test data. */ | 116 | /* Create some test data. */ |
117 | if (NULL == (data = malloc (TESTSTR_SIZE))) | 117 | if (NULL == (data = malloc (TESTSTR_SIZE))) |
@@ -248,7 +248,7 @@ ahc_empty (void *cls, | |||
248 | const char *version, | 248 | const char *version, |
249 | const char *upload_data, | 249 | const char *upload_data, |
250 | size_t *upload_data_size, | 250 | size_t *upload_data_size, |
251 | void **unused) | 251 | void **req_cls) |
252 | { | 252 | { |
253 | static int ptr; | 253 | static int ptr; |
254 | struct MHD_Response *response; | 254 | struct MHD_Response *response; |
@@ -264,12 +264,12 @@ ahc_empty (void *cls, | |||
264 | if (0 != strcmp ("GET", | 264 | if (0 != strcmp ("GET", |
265 | method)) | 265 | method)) |
266 | return MHD_NO; /* unexpected method */ | 266 | return MHD_NO; /* unexpected method */ |
267 | if (&ptr != *unused) | 267 | if (&ptr != *req_cls) |
268 | { | 268 | { |
269 | *unused = &ptr; | 269 | *req_cls = &ptr; |
270 | return MHD_YES; | 270 | return MHD_YES; |
271 | } | 271 | } |
272 | *unused = NULL; | 272 | *req_cls = NULL; |
273 | 273 | ||
274 | iov.iov_base = NULL; | 274 | iov.iov_base = NULL; |
275 | iov.iov_len = 0; | 275 | iov.iov_len = 0; |
diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c index 5c04aaab..65570aab 100644 --- a/src/testcurl/https/test_https_get_select.c +++ b/src/testcurl/https/test_https_get_select.c | |||
@@ -46,7 +46,7 @@ ahc_echo (void *cls, | |||
46 | const char *method, | 46 | const char *method, |
47 | const char *version, | 47 | const char *version, |
48 | const char *upload_data, size_t *upload_data_size, | 48 | const char *upload_data, size_t *upload_data_size, |
49 | void **unused) | 49 | void **req_cls) |
50 | { | 50 | { |
51 | static int ptr; | 51 | static int ptr; |
52 | const char *me = cls; | 52 | const char *me = cls; |
@@ -56,12 +56,12 @@ ahc_echo (void *cls, | |||
56 | 56 | ||
57 | if (0 != strcmp (me, method)) | 57 | if (0 != strcmp (me, method)) |
58 | return MHD_NO; /* unexpected method */ | 58 | return MHD_NO; /* unexpected method */ |
59 | if (&ptr != *unused) | 59 | if (&ptr != *req_cls) |
60 | { | 60 | { |
61 | *unused = &ptr; | 61 | *req_cls = &ptr; |
62 | return MHD_YES; | 62 | return MHD_YES; |
63 | } | 63 | } |
64 | *unused = NULL; | 64 | *req_cls = NULL; |
65 | response = MHD_create_response_from_buffer (strlen (url), | 65 | response = MHD_create_response_from_buffer (strlen (url), |
66 | (void *) url, | 66 | (void *) url, |
67 | MHD_RESPMEM_MUST_COPY); | 67 | MHD_RESPMEM_MUST_COPY); |
diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c index 3a49ce60..e428e278 100644 --- a/src/testcurl/https/test_https_session_info.c +++ b/src/testcurl/https/test_https_session_info.c | |||
@@ -47,7 +47,7 @@ static enum MHD_Result | |||
47 | query_session_ahc (void *cls, struct MHD_Connection *connection, | 47 | query_session_ahc (void *cls, struct MHD_Connection *connection, |
48 | const char *url, const char *method, | 48 | const char *url, const char *method, |
49 | const char *version, const char *upload_data, | 49 | const char *version, const char *upload_data, |
50 | size_t *upload_data_size, void **ptr) | 50 | size_t *upload_data_size, void **req_cls) |
51 | { | 51 | { |
52 | struct MHD_Response *response; | 52 | struct MHD_Response *response; |
53 | enum MHD_Result ret; | 53 | enum MHD_Result ret; |
@@ -55,9 +55,9 @@ query_session_ahc (void *cls, struct MHD_Connection *connection, | |||
55 | (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ | 55 | (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ |
56 | (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ | 56 | (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ |
57 | 57 | ||
58 | if (NULL == *ptr) | 58 | if (NULL == *req_cls) |
59 | { | 59 | { |
60 | *ptr = (void *) &query_session_ahc; | 60 | *req_cls = (void *) &query_session_ahc; |
61 | return MHD_YES; | 61 | return MHD_YES; |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c index 9cce3d94..606ac7a3 100644 --- a/src/testcurl/https/tls_test_common.c +++ b/src/testcurl/https/tls_test_common.c | |||
@@ -207,7 +207,7 @@ http_ahc (void *cls, | |||
207 | const char *version, | 207 | const char *version, |
208 | const char *upload_data, | 208 | const char *upload_data, |
209 | size_t *upload_data_size, | 209 | size_t *upload_data_size, |
210 | void **ptr) | 210 | void **req_cls) |
211 | { | 211 | { |
212 | static int aptr; | 212 | static int aptr; |
213 | struct MHD_Response *response; | 213 | struct MHD_Response *response; |
@@ -217,13 +217,13 @@ http_ahc (void *cls, | |||
217 | 217 | ||
218 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) | 218 | if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) |
219 | return MHD_NO; /* unexpected method */ | 219 | return MHD_NO; /* unexpected method */ |
220 | if (&aptr != *ptr) | 220 | if (&aptr != *req_cls) |
221 | { | 221 | { |
222 | /* do never respond on first call */ | 222 | /* do never respond on first call */ |
223 | *ptr = &aptr; | 223 | *req_cls = &aptr; |
224 | return MHD_YES; | 224 | return MHD_YES; |
225 | } | 225 | } |
226 | *ptr = NULL; /* reset when done */ | 226 | *req_cls = NULL; /* reset when done */ |
227 | response = MHD_create_response_from_buffer (strlen (test_data), | 227 | response = MHD_create_response_from_buffer (strlen (test_data), |
228 | (void *) test_data, | 228 | (void *) test_data, |
229 | MHD_RESPMEM_PERSISTENT); | 229 | MHD_RESPMEM_PERSISTENT); |
@@ -242,7 +242,7 @@ http_dummy_ahc (void *cls, | |||
242 | const char *version, | 242 | const char *version, |
243 | const char *upload_data, | 243 | const char *upload_data, |
244 | size_t *upload_data_size, | 244 | size_t *upload_data_size, |
245 | void **ptr) | 245 | void **req_cls) |
246 | { | 246 | { |
247 | (void) cls; | 247 | (void) cls; |
248 | (void) connection; | 248 | (void) connection; |
@@ -251,7 +251,7 @@ http_dummy_ahc (void *cls, | |||
251 | (void) version; /* Unused. Silent compiler warning. */ | 251 | (void) version; /* Unused. Silent compiler warning. */ |
252 | (void) upload_data; | 252 | (void) upload_data; |
253 | (void) upload_data_size; | 253 | (void) upload_data_size; |
254 | (void) ptr; /* Unused. Silent compiler warning. */ | 254 | (void) req_cls; /* Unused. Silent compiler warning. */ |
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
257 | 257 | ||
diff --git a/src/testcurl/https/tls_test_common.h b/src/testcurl/https/tls_test_common.h index a9af504d..b6a11172 100644 --- a/src/testcurl/https/tls_test_common.h +++ b/src/testcurl/https/tls_test_common.h | |||
@@ -106,13 +106,13 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx); | |||
106 | enum MHD_Result | 106 | enum MHD_Result |
107 | http_ahc (void *cls, struct MHD_Connection *connection, | 107 | http_ahc (void *cls, struct MHD_Connection *connection, |
108 | const char *url, const char *method, const char *upload_data, | 108 | const char *url, const char *method, const char *upload_data, |
109 | const char *version, size_t *upload_data_size, void **ptr); | 109 | const char *version, size_t *upload_data_size, void **req_cls); |
110 | 110 | ||
111 | enum MHD_Result | 111 | enum MHD_Result |
112 | http_dummy_ahc (void *cls, struct MHD_Connection *connection, | 112 | http_dummy_ahc (void *cls, struct MHD_Connection *connection, |
113 | const char *url, const char *method, const char *upload_data, | 113 | const char *url, const char *method, const char *upload_data, |
114 | const char *version, size_t *upload_data_size, | 114 | const char *version, size_t *upload_data_size, |
115 | void **ptr); | 115 | void **req_cls); |
116 | 116 | ||
117 | 117 | ||
118 | /** | 118 | /** |
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c index 9a7e3e08..3ee1c388 100644 --- a/src/testcurl/perf_get.c +++ b/src/testcurl/perf_get.c | |||
@@ -168,7 +168,7 @@ ahc_echo (void *cls, | |||
168 | const char *method, | 168 | const char *method, |
169 | const char *version, | 169 | const char *version, |
170 | const char *upload_data, size_t *upload_data_size, | 170 | const char *upload_data, size_t *upload_data_size, |
171 | void **unused) | 171 | void **req_cls) |
172 | { | 172 | { |
173 | static int ptr; | 173 | static int ptr; |
174 | const char *me = cls; | 174 | const char *me = cls; |
@@ -178,12 +178,12 @@ ahc_echo (void *cls, | |||
178 | 178 | ||
179 | if (0 != strcmp (me, method)) | 179 | if (0 != strcmp (me, method)) |
180 | return MHD_NO; /* unexpected method */ | 180 | return MHD_NO; /* unexpected method */ |
181 | if (&ptr != *unused) | 181 | if (&ptr != *req_cls) |
182 | { | 182 | { |
183 | *unused = &ptr; | 183 | *req_cls = &ptr; |
184 | return MHD_YES; | 184 | return MHD_YES; |
185 | } | 185 | } |
186 | *unused = NULL; | 186 | *req_cls = NULL; |
187 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); | 187 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); |
188 | if (ret == MHD_NO) | 188 | if (ret == MHD_NO) |
189 | abort (); | 189 | abort (); |
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c index 7427ef42..ea282874 100644 --- a/src/testcurl/perf_get_concurrent.c +++ b/src/testcurl/perf_get_concurrent.c | |||
@@ -159,7 +159,7 @@ ahc_echo (void *cls, | |||
159 | const char *method, | 159 | const char *method, |
160 | const char *version, | 160 | const char *version, |
161 | const char *upload_data, size_t *upload_data_size, | 161 | const char *upload_data, size_t *upload_data_size, |
162 | void **unused) | 162 | void **req_cls) |
163 | { | 163 | { |
164 | static int ptr; | 164 | static int ptr; |
165 | const char *me = cls; | 165 | const char *me = cls; |
@@ -169,12 +169,12 @@ ahc_echo (void *cls, | |||
169 | 169 | ||
170 | if (0 != strcmp (me, method)) | 170 | if (0 != strcmp (me, method)) |
171 | return MHD_NO; /* unexpected method */ | 171 | return MHD_NO; /* unexpected method */ |
172 | if (&ptr != *unused) | 172 | if (&ptr != *req_cls) |
173 | { | 173 | { |
174 | *unused = &ptr; | 174 | *req_cls = &ptr; |
175 | return MHD_YES; | 175 | return MHD_YES; |
176 | } | 176 | } |
177 | *unused = NULL; | 177 | *req_cls = NULL; |
178 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); | 178 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); |
179 | if (ret == MHD_NO) | 179 | if (ret == MHD_NO) |
180 | abort (); | 180 | abort (); |
diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c index 746ecbaf..811bfba4 100644 --- a/src/testcurl/test_add_conn.c +++ b/src/testcurl/test_add_conn.c | |||
@@ -148,7 +148,7 @@ ahc_echo (void *cls, | |||
148 | const char *method, | 148 | const char *method, |
149 | const char *version, | 149 | const char *version, |
150 | const char *upload_data, size_t *upload_data_size, | 150 | const char *upload_data, size_t *upload_data_size, |
151 | void **unused) | 151 | void **req_cls) |
152 | { | 152 | { |
153 | static int ptr; | 153 | static int ptr; |
154 | const char *me = cls; | 154 | const char *me = cls; |
@@ -161,12 +161,12 @@ ahc_echo (void *cls, | |||
161 | 161 | ||
162 | if (0 != strcmp (me, method)) | 162 | if (0 != strcmp (me, method)) |
163 | return MHD_NO; /* unexpected method */ | 163 | return MHD_NO; /* unexpected method */ |
164 | if (&ptr != *unused) | 164 | if (&ptr != *req_cls) |
165 | { | 165 | { |
166 | *unused = &ptr; | 166 | *req_cls = &ptr; |
167 | return MHD_YES; | 167 | return MHD_YES; |
168 | } | 168 | } |
169 | *unused = NULL; | 169 | *req_cls = NULL; |
170 | v = MHD_lookup_connection_value (connection, | 170 | v = MHD_lookup_connection_value (connection, |
171 | MHD_GET_ARGUMENT_KIND, | 171 | MHD_GET_ARGUMENT_KIND, |
172 | "a"); | 172 | "a"); |
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c index 8290851c..8b23ed02 100644 --- a/src/testcurl/test_callback.c +++ b/src/testcurl/test_callback.c | |||
@@ -69,7 +69,7 @@ callback (void *cls, | |||
69 | const char *version, | 69 | const char *version, |
70 | const char *upload_data, | 70 | const char *upload_data, |
71 | size_t *upload_data_size, | 71 | size_t *upload_data_size, |
72 | void **con_cls) | 72 | void **req_cls) |
73 | { | 73 | { |
74 | struct callback_closure *cbc = calloc (1, sizeof(struct callback_closure)); | 74 | struct callback_closure *cbc = calloc (1, sizeof(struct callback_closure)); |
75 | struct MHD_Response *r; | 75 | struct MHD_Response *r; |
@@ -81,7 +81,7 @@ callback (void *cls, | |||
81 | (void) version; | 81 | (void) version; |
82 | (void) upload_data; /* Unused. Silent compiler warning. */ | 82 | (void) upload_data; /* Unused. Silent compiler warning. */ |
83 | (void) upload_data_size; | 83 | (void) upload_data_size; |
84 | (void) con_cls; /* Unused. Silent compiler warning. */ | 84 | (void) req_cls; /* Unused. Silent compiler warning. */ |
85 | 85 | ||
86 | if (NULL == cbc) | 86 | if (NULL == cbc) |
87 | return MHD_NO; | 87 | return MHD_NO; |
diff --git a/src/testcurl/test_concurrent_stop.c b/src/testcurl/test_concurrent_stop.c index ee41ef94..306b2b5b 100644 --- a/src/testcurl/test_concurrent_stop.c +++ b/src/testcurl/test_concurrent_stop.c | |||
@@ -143,7 +143,7 @@ ahc_echo (void *cls, | |||
143 | const char *version, | 143 | const char *version, |
144 | const char *upload_data, | 144 | const char *upload_data, |
145 | size_t *upload_data_size, | 145 | size_t *upload_data_size, |
146 | void **usr_data) | 146 | void **req_cls) |
147 | { | 147 | { |
148 | static int marker; | 148 | static int marker; |
149 | const char *me = cls; | 149 | const char *me = cls; |
@@ -153,12 +153,12 @@ ahc_echo (void *cls, | |||
153 | 153 | ||
154 | if (0 != strcmp (me, method)) | 154 | if (0 != strcmp (me, method)) |
155 | return MHD_NO; /* unexpected method */ | 155 | return MHD_NO; /* unexpected method */ |
156 | if (&marker != *usr_data) | 156 | if (&marker != *req_cls) |
157 | { | 157 | { |
158 | *usr_data = ▮ | 158 | *req_cls = ▮ |
159 | return MHD_YES; | 159 | return MHD_YES; |
160 | } | 160 | } |
161 | *usr_data = NULL; | 161 | *req_cls = NULL; |
162 | ret = MHD_queue_response (connection, | 162 | ret = MHD_queue_response (connection, |
163 | MHD_HTTP_OK, | 163 | MHD_HTTP_OK, |
164 | response); | 164 | response); |
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c index 43bd2840..f0e89395 100644 --- a/src/testcurl/test_delete.c +++ b/src/testcurl/test_delete.c | |||
@@ -90,12 +90,12 @@ ahc_echo (void *cls, | |||
90 | const char *method, | 90 | const char *method, |
91 | const char *version, | 91 | const char *version, |
92 | const char *upload_data, size_t *upload_data_size, | 92 | const char *upload_data, size_t *upload_data_size, |
93 | void **unused) | 93 | void **req_cls) |
94 | { | 94 | { |
95 | int *done = cls; | 95 | int *done = cls; |
96 | struct MHD_Response *response; | 96 | struct MHD_Response *response; |
97 | enum MHD_Result ret; | 97 | enum MHD_Result ret; |
98 | (void) version; (void) unused; /* Unused. Silent compiler warning. */ | 98 | (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ |
99 | 99 | ||
100 | if (0 != strcmp ("DELETE", method)) | 100 | if (0 != strcmp ("DELETE", method)) |
101 | return MHD_NO; /* unexpected method */ | 101 | return MHD_NO; /* unexpected method */ |
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c index 3b2f2501..13c9c826 100644 --- a/src/testcurl/test_digestauth.c +++ b/src/testcurl/test_digestauth.c | |||
@@ -86,7 +86,7 @@ ahc_echo (void *cls, | |||
86 | const char *version, | 86 | const char *version, |
87 | const char *upload_data, | 87 | const char *upload_data, |
88 | size_t *upload_data_size, | 88 | size_t *upload_data_size, |
89 | void **unused) | 89 | void **req_cls) |
90 | { | 90 | { |
91 | struct MHD_Response *response; | 91 | struct MHD_Response *response; |
92 | char *username; | 92 | char *username; |
@@ -96,7 +96,7 @@ ahc_echo (void *cls, | |||
96 | int ret_i; | 96 | int ret_i; |
97 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 97 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
98 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 98 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
99 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 99 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
100 | 100 | ||
101 | username = MHD_digest_auth_get_username (connection); | 101 | username = MHD_digest_auth_get_username (connection); |
102 | if ( (username == NULL) || | 102 | if ( (username == NULL) || |
diff --git a/src/testcurl/test_digestauth_sha256.c b/src/testcurl/test_digestauth_sha256.c index a720c69b..7f8ebcd5 100644 --- a/src/testcurl/test_digestauth_sha256.c +++ b/src/testcurl/test_digestauth_sha256.c | |||
@@ -87,7 +87,7 @@ ahc_echo (void *cls, | |||
87 | const char *version, | 87 | const char *version, |
88 | const char *upload_data, | 88 | const char *upload_data, |
89 | size_t *upload_data_size, | 89 | size_t *upload_data_size, |
90 | void **unused) | 90 | void **req_cls) |
91 | { | 91 | { |
92 | struct MHD_Response *response; | 92 | struct MHD_Response *response; |
93 | char *username; | 93 | char *username; |
@@ -97,7 +97,7 @@ ahc_echo (void *cls, | |||
97 | int ret_i; | 97 | int ret_i; |
98 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 98 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
99 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 99 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
100 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 100 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
101 | 101 | ||
102 | username = MHD_digest_auth_get_username (connection); | 102 | username = MHD_digest_auth_get_username (connection); |
103 | if ( (username == NULL) || | 103 | if ( (username == NULL) || |
diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c index 523c9552..ce4b8970 100644 --- a/src/testcurl/test_digestauth_with_arguments.c +++ b/src/testcurl/test_digestauth_with_arguments.c | |||
@@ -80,7 +80,7 @@ ahc_echo (void *cls, | |||
80 | const char *method, | 80 | const char *method, |
81 | const char *version, | 81 | const char *version, |
82 | const char *upload_data, size_t *upload_data_size, | 82 | const char *upload_data, size_t *upload_data_size, |
83 | void **unused) | 83 | void **req_cls) |
84 | { | 84 | { |
85 | struct MHD_Response *response; | 85 | struct MHD_Response *response; |
86 | char *username; | 86 | char *username; |
@@ -90,7 +90,7 @@ ahc_echo (void *cls, | |||
90 | int ret_i; | 90 | int ret_i; |
91 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 91 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
92 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 92 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
93 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 93 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
94 | 94 | ||
95 | username = MHD_digest_auth_get_username (connection); | 95 | username = MHD_digest_auth_get_username (connection); |
96 | if ( (username == NULL) || | 96 | if ( (username == NULL) || |
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c index 58febf7a..a60c0797 100644 --- a/src/testcurl/test_get.c +++ b/src/testcurl/test_get.c | |||
@@ -107,7 +107,7 @@ ahc_echo (void *cls, | |||
107 | const char *method, | 107 | const char *method, |
108 | const char *version, | 108 | const char *version, |
109 | const char *upload_data, size_t *upload_data_size, | 109 | const char *upload_data, size_t *upload_data_size, |
110 | void **unused) | 110 | void **req_cls) |
111 | { | 111 | { |
112 | static int ptr; | 112 | static int ptr; |
113 | const char *me = cls; | 113 | const char *me = cls; |
@@ -120,12 +120,12 @@ ahc_echo (void *cls, | |||
120 | 120 | ||
121 | if (0 != strcmp (me, method)) | 121 | if (0 != strcmp (me, method)) |
122 | return MHD_NO; /* unexpected method */ | 122 | return MHD_NO; /* unexpected method */ |
123 | if (&ptr != *unused) | 123 | if (&ptr != *req_cls) |
124 | { | 124 | { |
125 | *unused = &ptr; | 125 | *req_cls = &ptr; |
126 | return MHD_YES; | 126 | return MHD_YES; |
127 | } | 127 | } |
128 | *unused = NULL; | 128 | *req_cls = NULL; |
129 | v = MHD_lookup_connection_value (connection, | 129 | v = MHD_lookup_connection_value (connection, |
130 | MHD_GET_ARGUMENT_KIND, | 130 | MHD_GET_ARGUMENT_KIND, |
131 | "a"); | 131 | "a"); |
@@ -745,7 +745,7 @@ ahc_empty (void *cls, | |||
745 | const char *version, | 745 | const char *version, |
746 | const char *upload_data, | 746 | const char *upload_data, |
747 | size_t *upload_data_size, | 747 | size_t *upload_data_size, |
748 | void **unused) | 748 | void **req_cls) |
749 | { | 749 | { |
750 | static int ptr; | 750 | static int ptr; |
751 | struct MHD_Response *response; | 751 | struct MHD_Response *response; |
@@ -759,12 +759,12 @@ ahc_empty (void *cls, | |||
759 | 759 | ||
760 | if (0 != strcmp ("GET", method)) | 760 | if (0 != strcmp ("GET", method)) |
761 | return MHD_NO; /* unexpected method */ | 761 | return MHD_NO; /* unexpected method */ |
762 | if (&ptr != *unused) | 762 | if (&ptr != *req_cls) |
763 | { | 763 | { |
764 | *unused = &ptr; | 764 | *req_cls = &ptr; |
765 | return MHD_YES; | 765 | return MHD_YES; |
766 | } | 766 | } |
767 | *unused = NULL; | 767 | *req_cls = NULL; |
768 | response = MHD_create_response_from_buffer (0, | 768 | response = MHD_create_response_from_buffer (0, |
769 | NULL, | 769 | NULL, |
770 | MHD_RESPMEM_PERSISTENT); | 770 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c index 5a19a24e..876016cc 100644 --- a/src/testcurl/test_get_chunked.c +++ b/src/testcurl/test_get_chunked.c | |||
@@ -180,7 +180,7 @@ ahc_echo (void *cls, | |||
180 | const char *url, | 180 | const char *url, |
181 | const char *method, | 181 | const char *method, |
182 | const char *version, | 182 | const char *version, |
183 | const char *upload_data, size_t *upload_data_size, void **ptr) | 183 | const char *upload_data, size_t *upload_data_size, void **req_cls) |
184 | { | 184 | { |
185 | static int aptr; | 185 | static int aptr; |
186 | const char *me = cls; | 186 | const char *me = cls; |
@@ -194,10 +194,10 @@ ahc_echo (void *cls, | |||
194 | 194 | ||
195 | if (0 != strcmp (me, method)) | 195 | if (0 != strcmp (me, method)) |
196 | return MHD_NO; /* unexpected method */ | 196 | return MHD_NO; /* unexpected method */ |
197 | if (&aptr != *ptr) | 197 | if (&aptr != *req_cls) |
198 | { | 198 | { |
199 | /* do never respond on first call */ | 199 | /* do never respond on first call */ |
200 | *ptr = &aptr; | 200 | *req_cls = &aptr; |
201 | return MHD_YES; | 201 | return MHD_YES; |
202 | } | 202 | } |
203 | if (! resp_string) | 203 | if (! resp_string) |
diff --git a/src/testcurl/test_get_close_keep_alive.c b/src/testcurl/test_get_close_keep_alive.c index 2fca0ce3..1cb46e68 100644 --- a/src/testcurl/test_get_close_keep_alive.c +++ b/src/testcurl/test_get_close_keep_alive.c | |||
@@ -312,7 +312,7 @@ ahc_echo (void *cls, | |||
312 | const char *method, | 312 | const char *method, |
313 | const char *version, | 313 | const char *version, |
314 | const char *upload_data, size_t *upload_data_size, | 314 | const char *upload_data, size_t *upload_data_size, |
315 | void **unused) | 315 | void **req_cls) |
316 | { | 316 | { |
317 | static int ptr; | 317 | static int ptr; |
318 | const char *me = cls; | 318 | const char *me = cls; |
@@ -324,12 +324,12 @@ ahc_echo (void *cls, | |||
324 | 324 | ||
325 | if (0 != strcmp (me, method)) | 325 | if (0 != strcmp (me, method)) |
326 | return MHD_NO; /* unexpected method */ | 326 | return MHD_NO; /* unexpected method */ |
327 | if (&ptr != *unused) | 327 | if (&ptr != *req_cls) |
328 | { | 328 | { |
329 | *unused = &ptr; | 329 | *req_cls = &ptr; |
330 | return MHD_YES; | 330 | return MHD_YES; |
331 | } | 331 | } |
332 | *unused = NULL; | 332 | *req_cls = NULL; |
333 | if (slow_reply) | 333 | if (slow_reply) |
334 | usleep (200000); | 334 | usleep (200000); |
335 | 335 | ||
diff --git a/src/testcurl/test_get_empty.c b/src/testcurl/test_get_empty.c index 5ed71ab9..fdbb2d42 100644 --- a/src/testcurl/test_get_empty.c +++ b/src/testcurl/test_get_empty.c | |||
@@ -107,7 +107,7 @@ ahc_echo (void *cls, | |||
107 | const char *method, | 107 | const char *method, |
108 | const char *version, | 108 | const char *version, |
109 | const char *upload_data, size_t *upload_data_size, | 109 | const char *upload_data, size_t *upload_data_size, |
110 | void **unused) | 110 | void **req_cls) |
111 | { | 111 | { |
112 | static int ptr; | 112 | static int ptr; |
113 | const char *me = cls; | 113 | const char *me = cls; |
@@ -119,12 +119,12 @@ ahc_echo (void *cls, | |||
119 | 119 | ||
120 | if (0 != strcmp (me, method)) | 120 | if (0 != strcmp (me, method)) |
121 | return MHD_NO; /* unexpected method */ | 121 | return MHD_NO; /* unexpected method */ |
122 | if (&ptr != *unused) | 122 | if (&ptr != *req_cls) |
123 | { | 123 | { |
124 | *unused = &ptr; | 124 | *req_cls = &ptr; |
125 | return MHD_YES; | 125 | return MHD_YES; |
126 | } | 126 | } |
127 | *unused = NULL; | 127 | *req_cls = NULL; |
128 | response = MHD_create_response_from_buffer (0, | 128 | response = MHD_create_response_from_buffer (0, |
129 | NULL, | 129 | NULL, |
130 | MHD_RESPMEM_PERSISTENT); | 130 | MHD_RESPMEM_PERSISTENT); |
@@ -703,7 +703,7 @@ ahc_empty (void *cls, | |||
703 | const char *method, | 703 | const char *method, |
704 | const char *version, | 704 | const char *version, |
705 | const char *upload_data, size_t *upload_data_size, | 705 | const char *upload_data, size_t *upload_data_size, |
706 | void **unused) | 706 | void **req_cls) |
707 | { | 707 | { |
708 | static int ptr; | 708 | static int ptr; |
709 | struct MHD_Response *response; | 709 | struct MHD_Response *response; |
@@ -717,12 +717,12 @@ ahc_empty (void *cls, | |||
717 | 717 | ||
718 | if (0 != strcmp ("GET", method)) | 718 | if (0 != strcmp ("GET", method)) |
719 | return MHD_NO; /* unexpected method */ | 719 | return MHD_NO; /* unexpected method */ |
720 | if (&ptr != *unused) | 720 | if (&ptr != *req_cls) |
721 | { | 721 | { |
722 | *unused = &ptr; | 722 | *req_cls = &ptr; |
723 | return MHD_YES; | 723 | return MHD_YES; |
724 | } | 724 | } |
725 | *unused = NULL; | 725 | *req_cls = NULL; |
726 | response = MHD_create_response_from_buffer (0, | 726 | response = MHD_create_response_from_buffer (0, |
727 | NULL, | 727 | NULL, |
728 | MHD_RESPMEM_PERSISTENT); | 728 | MHD_RESPMEM_PERSISTENT); |
diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c index ae30f6d6..bcb610dc 100644 --- a/src/testcurl/test_get_iovec.c +++ b/src/testcurl/test_get_iovec.c | |||
@@ -132,7 +132,7 @@ ahc_echo (void *cls, | |||
132 | const char *method, | 132 | const char *method, |
133 | const char *version, | 133 | const char *version, |
134 | const char *upload_data, size_t *upload_data_size, | 134 | const char *upload_data, size_t *upload_data_size, |
135 | void **unused) | 135 | void **req_cls) |
136 | { | 136 | { |
137 | static int ptr; | 137 | static int ptr; |
138 | const char *me = cls; | 138 | const char *me = cls; |
@@ -146,12 +146,12 @@ ahc_echo (void *cls, | |||
146 | 146 | ||
147 | if (0 != strcmp (me, method)) | 147 | if (0 != strcmp (me, method)) |
148 | return MHD_NO; /* unexpected method */ | 148 | return MHD_NO; /* unexpected method */ |
149 | if (&ptr != *unused) | 149 | if (&ptr != *req_cls) |
150 | { | 150 | { |
151 | *unused = &ptr; | 151 | *req_cls = &ptr; |
152 | return MHD_YES; | 152 | return MHD_YES; |
153 | } | 153 | } |
154 | *unused = NULL; | 154 | *req_cls = NULL; |
155 | 155 | ||
156 | /* Create some test data. */ | 156 | /* Create some test data. */ |
157 | if (NULL == (data = malloc (TESTSTR_SIZE))) | 157 | if (NULL == (data = malloc (TESTSTR_SIZE))) |
@@ -188,7 +188,7 @@ ncont_echo (void *cls, | |||
188 | const char *method, | 188 | const char *method, |
189 | const char *version, | 189 | const char *version, |
190 | const char *upload_data, size_t *upload_data_size, | 190 | const char *upload_data, size_t *upload_data_size, |
191 | void **unused) | 191 | void **req_cls) |
192 | { | 192 | { |
193 | static int ptr; | 193 | static int ptr; |
194 | const char *me = cls; | 194 | const char *me = cls; |
@@ -202,12 +202,12 @@ ncont_echo (void *cls, | |||
202 | 202 | ||
203 | if (0 != strcmp (me, method)) | 203 | if (0 != strcmp (me, method)) |
204 | return MHD_NO; /* unexpected method */ | 204 | return MHD_NO; /* unexpected method */ |
205 | if (&ptr != *unused) | 205 | if (&ptr != *req_cls) |
206 | { | 206 | { |
207 | *unused = &ptr; | 207 | *req_cls = &ptr; |
208 | return MHD_YES; | 208 | return MHD_YES; |
209 | } | 209 | } |
210 | *unused = NULL; | 210 | *req_cls = NULL; |
211 | 211 | ||
212 | if (NULL == (iov = malloc (sizeof(struct MHD_IoVec) * TESTSTR_IOVCNT))) | 212 | if (NULL == (iov = malloc (sizeof(struct MHD_IoVec) * TESTSTR_IOVCNT))) |
213 | return MHD_NO; | 213 | return MHD_NO; |
diff --git a/src/testcurl/test_get_response_cleanup.c b/src/testcurl/test_get_response_cleanup.c index efec5144..ededc88b 100644 --- a/src/testcurl/test_get_response_cleanup.c +++ b/src/testcurl/test_get_response_cleanup.c | |||
@@ -122,7 +122,7 @@ ahc_echo (void *cls, | |||
122 | const char *method, | 122 | const char *method, |
123 | const char *version, | 123 | const char *version, |
124 | const char *upload_data, size_t *upload_data_size, | 124 | const char *upload_data, size_t *upload_data_size, |
125 | void **unused) | 125 | void **req_cls) |
126 | { | 126 | { |
127 | static int ptr; | 127 | static int ptr; |
128 | const char *me = cls; | 128 | const char *me = cls; |
@@ -134,12 +134,12 @@ ahc_echo (void *cls, | |||
134 | // fprintf (stderr, "In CB: %s!\n", method); | 134 | // fprintf (stderr, "In CB: %s!\n", method); |
135 | if (0 != strcmp (me, method)) | 135 | if (0 != strcmp (me, method)) |
136 | return MHD_NO; /* unexpected method */ | 136 | return MHD_NO; /* unexpected method */ |
137 | if (&ptr != *unused) | 137 | if (&ptr != *req_cls) |
138 | { | 138 | { |
139 | *unused = &ptr; | 139 | *req_cls = &ptr; |
140 | return MHD_YES; | 140 | return MHD_YES; |
141 | } | 141 | } |
142 | *unused = NULL; | 142 | *req_cls = NULL; |
143 | response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, | 143 | response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, |
144 | 32 * 1024, | 144 | 32 * 1024, |
145 | &push_callback, | 145 | &push_callback, |
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c index 84929d81..4ca57e23 100644 --- a/src/testcurl/test_get_sendfile.c +++ b/src/testcurl/test_get_sendfile.c | |||
@@ -84,7 +84,7 @@ ahc_echo (void *cls, | |||
84 | const char *method, | 84 | const char *method, |
85 | const char *version, | 85 | const char *version, |
86 | const char *upload_data, size_t *upload_data_size, | 86 | const char *upload_data, size_t *upload_data_size, |
87 | void **unused) | 87 | void **req_cls) |
88 | { | 88 | { |
89 | static int ptr; | 89 | static int ptr; |
90 | const char *me = cls; | 90 | const char *me = cls; |
@@ -96,12 +96,12 @@ ahc_echo (void *cls, | |||
96 | 96 | ||
97 | if (0 != strcmp (me, method)) | 97 | if (0 != strcmp (me, method)) |
98 | return MHD_NO; /* unexpected method */ | 98 | return MHD_NO; /* unexpected method */ |
99 | if (&ptr != *unused) | 99 | if (&ptr != *req_cls) |
100 | { | 100 | { |
101 | *unused = &ptr; | 101 | *req_cls = &ptr; |
102 | return MHD_YES; | 102 | return MHD_YES; |
103 | } | 103 | } |
104 | *unused = NULL; | 104 | *req_cls = NULL; |
105 | fd = open (sourcefile, O_RDONLY); | 105 | fd = open (sourcefile, O_RDONLY); |
106 | if (fd == -1) | 106 | if (fd == -1) |
107 | { | 107 | { |
diff --git a/src/testcurl/test_get_wait.c b/src/testcurl/test_get_wait.c index 40fcaf6d..708c82bd 100644 --- a/src/testcurl/test_get_wait.c +++ b/src/testcurl/test_get_wait.c | |||
@@ -86,7 +86,7 @@ ahc_echo (void *cls, | |||
86 | const char *method, | 86 | const char *method, |
87 | const char *version, | 87 | const char *version, |
88 | const char *upload_data, size_t *upload_data_size, | 88 | const char *upload_data, size_t *upload_data_size, |
89 | void **unused) | 89 | void **req_cls) |
90 | { | 90 | { |
91 | static int ptr; | 91 | static int ptr; |
92 | const char *me = cls; | 92 | const char *me = cls; |
@@ -96,12 +96,12 @@ ahc_echo (void *cls, | |||
96 | 96 | ||
97 | if (0 != strcmp (me, method)) | 97 | if (0 != strcmp (me, method)) |
98 | return MHD_NO; /* unexpected method */ | 98 | return MHD_NO; /* unexpected method */ |
99 | if (&ptr != *unused) | 99 | if (&ptr != *req_cls) |
100 | { | 100 | { |
101 | *unused = &ptr; | 101 | *req_cls = &ptr; |
102 | return MHD_YES; | 102 | return MHD_YES; |
103 | } | 103 | } |
104 | *unused = NULL; | 104 | *req_cls = NULL; |
105 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); | 105 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); |
106 | if (ret == MHD_NO) | 106 | if (ret == MHD_NO) |
107 | abort (); | 107 | abort (); |
diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c index 09fe7773..509e3955 100644 --- a/src/testcurl/test_iplimit.c +++ b/src/testcurl/test_iplimit.c | |||
@@ -82,7 +82,7 @@ ahc_echo (void *cls, | |||
82 | const char *method, | 82 | const char *method, |
83 | const char *version, | 83 | const char *version, |
84 | const char *upload_data, size_t *upload_data_size, | 84 | const char *upload_data, size_t *upload_data_size, |
85 | void **unused) | 85 | void **req_cls) |
86 | { | 86 | { |
87 | static int ptr; | 87 | static int ptr; |
88 | const char *me = cls; | 88 | const char *me = cls; |
@@ -92,12 +92,12 @@ ahc_echo (void *cls, | |||
92 | 92 | ||
93 | if (0 != strcmp (me, method)) | 93 | if (0 != strcmp (me, method)) |
94 | return MHD_NO; /* unexpected method */ | 94 | return MHD_NO; /* unexpected method */ |
95 | if (&ptr != *unused) | 95 | if (&ptr != *req_cls) |
96 | { | 96 | { |
97 | *unused = &ptr; | 97 | *req_cls = &ptr; |
98 | return MHD_YES; | 98 | return MHD_YES; |
99 | } | 99 | } |
100 | *unused = NULL; | 100 | *req_cls = NULL; |
101 | response = MHD_create_response_from_buffer (strlen (url), | 101 | response = MHD_create_response_from_buffer (strlen (url), |
102 | (void *) url, | 102 | (void *) url, |
103 | MHD_RESPMEM_MUST_COPY); | 103 | MHD_RESPMEM_MUST_COPY); |
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c index b00d0e1a..161e0f0b 100644 --- a/src/testcurl/test_large_put.c +++ b/src/testcurl/test_large_put.c | |||
@@ -233,7 +233,7 @@ ahc_echo (void *cls, | |||
233 | const char *method, | 233 | const char *method, |
234 | const char *version, | 234 | const char *version, |
235 | const char *upload_data, size_t *upload_data_size, | 235 | const char *upload_data, size_t *upload_data_size, |
236 | void **pparam) | 236 | void **req_cls) |
237 | { | 237 | { |
238 | int *done = cls; | 238 | int *done = cls; |
239 | struct MHD_Response *response; | 239 | struct MHD_Response *response; |
@@ -259,13 +259,13 @@ ahc_echo (void *cls, | |||
259 | if ((*done) == 0) | 259 | if ((*done) == 0) |
260 | { | 260 | { |
261 | size_t *pproc; | 261 | size_t *pproc; |
262 | if (NULL == *pparam) | 262 | if (NULL == *req_cls) |
263 | { | 263 | { |
264 | processed = 0; | 264 | processed = 0; |
265 | /* Safe as long as only one parallel request served. */ | 265 | /* Safe as long as only one parallel request served. */ |
266 | *pparam = &processed; | 266 | *req_cls = &processed; |
267 | } | 267 | } |
268 | pproc = (size_t *) *pparam; | 268 | pproc = (size_t *) *req_cls; |
269 | 269 | ||
270 | if (0 == *upload_data_size) | 270 | if (0 == *upload_data_size) |
271 | return MHD_YES; /* No data to process. */ | 271 | return MHD_YES; /* No data to process. */ |
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c index b76ea90d..329c3955 100644 --- a/src/testcurl/test_long_header.c +++ b/src/testcurl/test_long_header.c | |||
@@ -78,13 +78,13 @@ ahc_echo (void *cls, | |||
78 | const char *method, | 78 | const char *method, |
79 | const char *version, | 79 | const char *version, |
80 | const char *upload_data, size_t *upload_data_size, | 80 | const char *upload_data, size_t *upload_data_size, |
81 | void **unused) | 81 | void **req_cls) |
82 | { | 82 | { |
83 | const char *me = cls; | 83 | const char *me = cls; |
84 | struct MHD_Response *response; | 84 | struct MHD_Response *response; |
85 | enum MHD_Result ret; | 85 | enum MHD_Result ret; |
86 | (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 86 | (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
87 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 87 | (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ |
88 | 88 | ||
89 | if (0 != strcmp (me, method)) | 89 | if (0 != strcmp (me, method)) |
90 | return MHD_NO; /* unexpected method */ | 90 | return MHD_NO; /* unexpected method */ |
diff --git a/src/testcurl/test_parse_cookies.c b/src/testcurl/test_parse_cookies.c index 07c67567..0fc5ffc1 100644 --- a/src/testcurl/test_parse_cookies.c +++ b/src/testcurl/test_parse_cookies.c | |||
@@ -68,7 +68,7 @@ ahc_echo (void *cls, | |||
68 | const char *method, | 68 | const char *method, |
69 | const char *version, | 69 | const char *version, |
70 | const char *upload_data, size_t *upload_data_size, | 70 | const char *upload_data, size_t *upload_data_size, |
71 | void **unused) | 71 | void **req_cls) |
72 | { | 72 | { |
73 | static int ptr; | 73 | static int ptr; |