commit bd41946e8f4f2086f7b2fcacc468a668c0676aff parent 17c22c2c3b8e2b56874ff701be58e7c10d1d41f4 Author: Evgeny Grin (Karlson2k) <k2k@narod.ru> Date: Tue, 18 Jan 2022 15:17:21 +0300 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. Diffstat:
105 files changed, 507 insertions(+), 510 deletions(-)
diff --git a/doc/chapters/basicauthentication.inc b/doc/chapters/basicauthentication.inc @@ -64,10 +64,10 @@ application should suspend the connection). @end enumerate But how can we tell whether the callback has been called before for the -particular connection? Initially, the pointer this parameter references is +particular request? Initially, the pointer this parameter references is set by @emph{MHD} in the callback. But it will also be "remembered" on the -next call (for the same connection). Thus, we can use the @code{con_cls} -location to keep track of the connection state. For now, we will simply +next call (for the same request). Thus, we can use the @code{req_cls} +location to keep track of the request state. For now, we will simply generate no response until the parameter is non-null---implying the callback was called before at least once. We do not need to share information between different calls of the callback, so we can set the parameter to any address @@ -81,10 +81,10 @@ static int answer_to_connection (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) + void **req_cls) { if (0 != strcmp(method, "GET")) return MHD_NO; - if (NULL == *con_cls) {*con_cls = connection; return MHD_YES;} + if (NULL == *req_cls) {*req_cls = connection; return MHD_YES;} ... /* else respond accordingly */ @@ -116,7 +116,7 @@ static int answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { char *user; char *pass; @@ -126,9 +126,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) return MHD_NO; - if (NULL == *con_cls) + if (NULL == *req_cls) { - *con_cls = connection; + *req_cls = connection; return MHD_YES; } pass = NULL; diff --git a/doc/chapters/exploringrequests.inc b/doc/chapters/exploringrequests.inc @@ -14,7 +14,7 @@ answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { ... return MHD_NO; diff --git a/doc/chapters/hellobrowser.inc b/doc/chapters/hellobrowser.inc @@ -43,7 +43,7 @@ int answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { const char *page = "<html><body>Hello, browser!</body></html>"; diff --git a/doc/chapters/largerpost.inc b/doc/chapters/largerpost.inc @@ -95,9 +95,9 @@ answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { - if (NULL == *con_cls) + if (NULL == *req_cls) { struct connection_info_struct *con_info; @@ -120,7 +120,7 @@ the addition of a filepointer for each connection. } else con_info->connectiontype = GET; - *con_cls = (void*) con_info; + *req_cls = (void*) con_info; return MHD_YES; } @@ -179,7 +179,7 @@ constituted no expected request method. @verbatim if (0 == strcmp (method, "POST")) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *req_cls; if (0 != *upload_data_size) { @@ -284,10 +284,10 @@ The new client was registered when the postprocessor was created. Likewise, we u on destroying the postprocessor when the request is completed. @verbatim void request_completed (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *req_cls; if (NULL == con_info) return; @@ -303,7 +303,7 @@ void request_completed (void *cls, struct MHD_Connection *connection, } free (con_info); - *con_cls = NULL; + *req_cls = NULL; } @end verbatim @noindent diff --git a/doc/chapters/processingpost.inc b/doc/chapters/processingpost.inc @@ -111,10 +111,10 @@ requests other than @emph{POST} requests. @verbatim void request_completed (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *req_cls; if (NULL == con_info) return; if (con_info->connectiontype == POST) @@ -124,7 +124,7 @@ void request_completed (void *cls, struct MHD_Connection *connection, } free (con_info); - *con_cls = NULL; + *req_cls = NULL; } @end verbatim @noindent @@ -155,9 +155,9 @@ answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { - if(NULL == *con_cls) + if(NULL == *req_cls) { struct connection_info_struct *con_info; @@ -190,7 +190,7 @@ of the request is stored for convenience. The address of our structure will both serve as the indicator for successive iterations and to remember the particular details about the connection. @verbatim - *con_cls = (void*) con_info; + *req_cls = (void*) con_info; return MHD_YES; } @end verbatim @@ -212,7 +212,7 @@ considered---all of it. @verbatim if (0 == strcmp (method, "POST")) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *req_cls; if (*upload_data_size != 0) { diff --git a/doc/chapters/responseheaders.inc b/doc/chapters/responseheaders.inc @@ -28,7 +28,7 @@ answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { unsigned char *buffer = NULL; struct MHD_Response *response; diff --git a/doc/chapters/websocket.inc b/doc/chapters/websocket.inc @@ -122,7 +122,7 @@ per connection, could look like this: static void upgrade_handler (void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket fd, @@ -501,7 +501,7 @@ callback function from an earlier example to a working websocket: static void upgrade_handler (void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket fd, diff --git a/doc/examples/basicauthentication.c b/doc/examples/basicauthentication.c @@ -21,7 +21,7 @@ static enum MHD_Result answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { char *user; char *pass; @@ -36,9 +36,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, if (0 != strcmp (method, "GET")) return MHD_NO; - if (NULL == *con_cls) + if (NULL == *req_cls) { - *con_cls = connection; + *req_cls = connection; return MHD_YES; } pass = NULL; diff --git a/doc/examples/hellobrowser.c b/doc/examples/hellobrowser.c @@ -18,7 +18,7 @@ static enum MHD_Result answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { const char *page = "<html><body>Hello, browser!</body></html>"; struct MHD_Response *response; @@ -29,7 +29,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, (void) version; /* Unused. Silent compiler warning. */ (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - (void) con_cls; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ response = MHD_create_response_from_buffer (strlen (page), (void *) page, diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c @@ -181,10 +181,10 @@ iterate_post (void *coninfo_cls, static void request_completed (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *req_cls; (void) cls; /* Unused. Silent compiler warning. */ (void) connection; /* Unused. Silent compiler warning. */ (void) toe; /* Unused. Silent compiler warning. */ @@ -205,7 +205,7 @@ request_completed (void *cls, } free (con_info); - *con_cls = NULL; + *req_cls = NULL; } @@ -217,13 +217,13 @@ answer_to_connection (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { (void) cls; /* Unused. Silent compiler warning. */ (void) url; /* Unused. Silent compiler warning. */ (void) version; /* Unused. Silent compiler warning. */ - if (NULL == *con_cls) + if (NULL == *req_cls) { /* First call, setup data structures */ struct connection_info_struct *con_info; @@ -262,7 +262,7 @@ answer_to_connection (void *cls, con_info->connectiontype = GET; } - *con_cls = (void *) con_info; + *req_cls = (void *) con_info; return MHD_YES; } @@ -283,7 +283,7 @@ answer_to_connection (void *cls, if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *req_cls; if (0 != *upload_data_size) { diff --git a/doc/examples/logging.c b/doc/examples/logging.c @@ -29,13 +29,13 @@ static enum MHD_Result answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { (void) cls; /* Unused. Silent compiler warning. */ (void) version; /* Unused. Silent compiler warning. */ (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - (void) con_cls; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ printf ("New %s request for %s using version %s\n", method, url, version); MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key, diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c @@ -23,7 +23,7 @@ static enum MHD_Result answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { struct MHD_Response *response; int fd; @@ -34,7 +34,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, (void) version; /* Unused. Silent compiler warning. */ (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - (void) con_cls; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp (method, "GET")) return MHD_NO; diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c @@ -548,7 +548,7 @@ post_iterator (void *cls, * @param upload_data_size set initially to the size of the * upload_data provided; the method must update this * value to the number of bytes NOT processed; - * @param ptr pointer that the callback can set to some + * @param req_cls pointer that the callback can set to some * address and that will be preserved by MHD for future * calls for this request; since the access handler may * be called many times (i.e., for a PUT/POST operation @@ -557,7 +557,7 @@ post_iterator (void *cls, * If necessary, this state can be cleaned up in the * global "MHD_RequestCompleted" callback (which * can be set with the MHD_OPTION_NOTIFY_COMPLETED). - * Initially, <tt>*con_cls</tt> will be NULL. + * Initially, <tt>*req_cls</tt> will be NULL. * @return MHS_YES if the connection was handled successfully, * MHS_NO if the socket must be closed due to a serious * error while handling the request @@ -570,7 +570,7 @@ create_response (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { struct MHD_Response *response; struct Request *request; @@ -580,7 +580,7 @@ create_response (void *cls, (void) cls; /* Unused. Silent compiler warning. */ (void) version; /* Unused. Silent compiler warning. */ - request = *ptr; + request = *req_cls; if (NULL == request) { request = calloc (1, sizeof (struct Request)); @@ -589,7 +589,7 @@ create_response (void *cls, fprintf (stderr, "calloc error: %s\n", strerror (errno)); return MHD_NO; } - *ptr = request; + *req_cls = request; if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) { request->pp = MHD_create_post_processor (connection, 1024, @@ -668,16 +668,16 @@ create_response (void *cls, * * @param cls not used * @param connection connection that completed - * @param con_cls session handle + * @param req_cls session handle * @param toe status code */ static void request_completed_callback (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct Request *request = *con_cls; + struct Request *request = *req_cls; (void) cls; /* Unused. Silent compiler warning. */ (void) connection; /* Unused. Silent compiler warning. */ (void) toe; /* Unused. Silent compiler warning. */ diff --git 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, static void request_completed (void *cls, struct MHD_Connection *connection, - void **con_cls, enum MHD_RequestTerminationCode toe) + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *req_cls; (void) cls; /* Unused. Silent compiler warning. */ (void) connection; /* Unused. Silent compiler warning. */ (void) toe; /* Unused. Silent compiler warning. */ @@ -123,7 +123,7 @@ request_completed (void *cls, struct MHD_Connection *connection, } free (con_info); - *con_cls = NULL; + *req_cls = NULL; } @@ -131,13 +131,13 @@ static enum MHD_Result answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { (void) cls; /* Unused. Silent compiler warning. */ (void) url; /* Unused. Silent compiler warning. */ (void) version; /* Unused. Silent compiler warning. */ - if (NULL == *con_cls) + if (NULL == *req_cls) { struct connection_info_struct *con_info; @@ -163,7 +163,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, else con_info->connectiontype = GET; - *con_cls = (void *) con_info; + *req_cls = (void *) con_info; return MHD_YES; } @@ -175,7 +175,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, if (0 == strcmp (method, "POST")) { - struct connection_info_struct *con_info = *con_cls; + struct connection_info_struct *con_info = *req_cls; if (*upload_data_size != 0) { diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c @@ -225,7 +225,7 @@ static enum MHD_Result answer_to_connection (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) + size_t *upload_data_size, void **req_cls) { (void) cls; /* Unused. Silent compiler warning. */ (void) url; /* Unused. Silent compiler warning. */ @@ -235,9 +235,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, if (0 != strcmp (method, "GET")) return MHD_NO; - if (NULL == *con_cls) + if (NULL == *req_cls) { - *con_cls = connection; + *req_cls = connection; return MHD_YES; } diff --git a/doc/examples/websocket.c b/doc/examples/websocket.c @@ -80,7 +80,7 @@ make_blocking (MHD_socket fd); static void upgrade_handler (void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket fd, @@ -307,7 +307,7 @@ access_handler (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct MHD_Response *response; @@ -319,13 +319,13 @@ access_handler (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ if (0 == strcmp (url, "/")) { diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi @@ -734,18 +734,15 @@ callback. The second pointer maybe @code{NULL}. @item MHD_OPTION_NOTIFY_CONNECTION Register a function that should be called when the TCP connection to a -client is opened or closed. Note that -@code{MHD_OPTION_NOTIFY_COMPLETED} and the @code{con_cls} argument to -the @code{MHD_AccessHandlerCallback} are per HTTP request (and there -can be multiple HTTP requests per TCP connection). The registered -callback is called twice per TCP connection, with -@code{MHD_CONNECTION_NOTIFY_STARTED} and -@code{MHD_CONNECTION_NOTIFY_CLOSED} respectively. An additional +client is opened or closed. The registered callback is called twice per +TCP connection, with @code{MHD_CONNECTION_NOTIFY_STARTED} and +@code{MHD_CONNECTION_NOTIFY_CLOSED} respectively. An additional argument can be used to store TCP connection specific information, which can be retrieved using @code{MHD_CONNECTION_INFO_SOCKET_CONTEXT} -during the lifetime of the TCP connection. The respective location is -not the same as the HTTP-request-specific @code{con_cls} from the -@code{MHD_AccessHandlerCallback}. +during the lifetime of the TCP connection. +Note @code{MHD_OPTION_NOTIFY_COMPLETED} and the @code{req_cls} argument +to the @code{MHD_AccessHandlerCallback} are per HTTP request (and there +can be multiple HTTP requests per TCP connection). This option should be followed by @strong{TWO} pointers. First a pointer to a function of type @code{MHD_NotifyConnectionCallback()} @@ -820,12 +817,12 @@ one must be of the form void * my_logger(void * cls, const char * uri, struct MHD_Connection *con) @end example where the return value will be passed as -@code{*con_cls} in calls to the @code{MHD_AccessHandlerCallback} +@code{*req_cls} in calls to the @code{MHD_AccessHandlerCallback} when this request is processed later; returning a value of @code{NULL} has no special significance; (however, note that if you return non-@code{NULL}, you can no longer rely on the first call to the access handler having -@code{NULL == *con_cls} on entry) +@code{NULL == *req_cls} on entry) @code{cls} will be set to the second argument following MHD_OPTION_URI_LOG_CALLBACK. Finally, @code{uri} will be the 0-terminated URI of the request. @@ -1808,7 +1805,7 @@ length of the address information. @end deftypefn -@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) +@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) Invoked in the context of a connection to answer a request from the client. This callback must call MHD functions (example: the @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 avoid this, clients must be able to process upload data incrementally and reduce the value of @code{upload_data_size}. -@item con_cls +@item req_cls reference to a pointer, initially set to @code{NULL}, that this callback can set to some address and that will be preserved by MHD for future calls for this request; @@ -1890,7 +1887,7 @@ if necessary, this state can be cleaned up in the global @end deftypefn -@deftypefn {Function Pointer} void {*MHD_RequestCompletedCallback} (void *cls, struct MHD_Connectionconnection, void **con_cls, enum MHD_RequestTerminationCode toe) +@deftypefn {Function Pointer} void {*MHD_RequestCompletedCallback} (void *cls, struct MHD_Connectionconnection, void **req_cls, enum MHD_RequestTerminationCode toe) Signature of the callback used by MHD to notify the application about completed requests. @@ -1901,7 +1898,7 @@ custom value selected at callback registration time; @item connection connection handle; -@item con_cls +@item req_cls value as set by the last call to the @code{MHD_AccessHandlerCallback}; @@ -2944,8 +2941,8 @@ matches the @code{upgrade_handler_cls} that was given to @code{MHD_create_respon @item connection identifies the connection that is being upgraded; -@item con_cls -last value left in `*con_cls` in the `MHD_AccessHandlerCallback` +@item req_cls +last value left in `*req_cls` in the `MHD_AccessHandlerCallback` @item extra_in 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 be processed. The arguments @var{upload_data} and @var{upload_data_size} are used to reference the chunk of data. -When @code{MHD_AccessHandlerCallback} is invoked for a new connection: -its @code{*@var{con_cls}} argument is set to @code{NULL}. When @code{POST} +When @code{MHD_AccessHandlerCallback} is invoked for a new request: +its @code{*@var{req_cls}} argument is set to @code{NULL}. When @code{POST} data comes in the upload buffer it is @strong{mandatory} to use the -@var{con_cls} to store a reference to per-connection data. The fact +@var{req_cls} to store a reference to per-request data. The fact that the pointer was initially @code{NULL} can be used to detect that this is a new request. -One method to detect that a new connection was established is -to set @code{*con_cls} to an unused integer: +One method to detect that a new request was started is +to set @code{*req_cls} to an unused integer: @example int @@ -3394,15 +3391,15 @@ access_handler (void *cls, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) @{ static int old_connection_marker; - int new_connection = (NULL == *con_cls); + int new_connection = (NULL == *req_cls); if (new_connection) @{ /* new connection with POST */ - *con_cls = &old_connection_marker; + *req_cls = &old_connection_marker; @} ... @@ -3411,7 +3408,7 @@ access_handler (void *cls, @noindent In contrast to the previous example, for @code{POST} requests in particular, -it is more common to use the value of @code{*con_cls} to keep track of +it is more common to use the value of @code{*req_cls} to keep track of actual state used during processing, such as the post processor (or a struct containing a post processor): @@ -3422,14 +3419,14 @@ access_handler (void *cls, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) @{ - struct MHD_PostProcessor * pp = *con_cls; + struct MHD_PostProcessor * pp = *req_cls; if (pp == NULL) @{ pp = MHD_create_post_processor(connection, ...); - *con_cls = pp; + *req_cls = pp; return MHD_YES; @} if (*upload_data_size) @@ -3719,8 +3716,8 @@ Takes no extra arguments. Returns the client-specific pointer to a @code{void *} that was (possibly) set during a @code{MHD_NotifyConnectionCallback} when the socket was first accepted. Note that this is NOT the same as the -@code{con_cls} argument of the @code{MHD_AccessHandlerCallback}. The -@code{con_cls} is fresh for each HTTP request, while the +@code{req_cls} argument of the @code{MHD_AccessHandlerCallback}. The +@code{req_cls} is fresh for each HTTP request, while the @code{socket_context} is fresh for each socket. Takes no extra arguments. diff --git a/src/examples/authorization_example.c b/src/examples/authorization_example.c @@ -45,7 +45,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { static int aptr; const char *me = cls; @@ -61,13 +61,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ /* require: "Aladdin" with password "open sesame" */ pass = NULL; diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c @@ -62,7 +62,7 @@ static struct MHD_Response *response; * * @param cls client-defined closure * @param connection connection handle - * @param con_cls value as set by the last call to + * @param req_cls value as set by the last call to * the MHD_AccessHandlerCallback * @param toe reason for request termination * @see MHD_OPTION_NOTIFY_COMPLETED @@ -70,10 +70,10 @@ static struct MHD_Response *response; static void completed_callback (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct timeval *tv = *con_cls; + struct timeval *tv = *req_cls; struct timeval tve; uint64_t delta; (void) cls; /* Unused. Silent compiler warning. */ @@ -119,14 +119,14 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { (void) cls; /* Unused. Silent compiler warning. */ (void) url; /* Unused. Silent compiler warning. */ (void) version; /* Unused. Silent compiler warning. */ (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - (void) ptr; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c @@ -62,7 +62,7 @@ static struct MHD_Response *response; * * @param cls client-defined closure * @param connection connection handle - * @param con_cls value as set by the last call to + * @param req_cls value as set by the last call to * the MHD_AccessHandlerCallback * @param toe reason for request termination * @see MHD_OPTION_NOTIFY_COMPLETED @@ -70,10 +70,10 @@ static struct MHD_Response *response; static void completed_callback (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct timeval *tv = *con_cls; + struct timeval *tv = *req_cls; struct timeval tve; uint64_t delta; (void) cls; /* Unused. Silent compiler warning. */ @@ -119,14 +119,14 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { (void) cls; /* Unused. Silent compiler warning. */ (void) url; /* Unused. Silent compiler warning. */ (void) version; /* Unused. Silent compiler warning. */ (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - (void) ptr; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c @@ -97,7 +97,7 @@ ahc_echo (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct ResponseContentCallbackParam *callback_param; @@ -111,10 +111,10 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } @@ -126,7 +126,7 @@ ahc_echo (void *cls, callback_param->response_size = (sizeof(simple_response_text) / sizeof(char)) - 1; - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024, &callback, diff --git a/src/examples/connection_close.c b/src/examples/connection_close.c @@ -41,7 +41,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { static int aptr; const char *me = cls; @@ -54,13 +54,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_buffer (strlen (me), (void *) me, MHD_RESPMEM_PERSISTENT); @@ -75,7 +75,7 @@ ahc_echo (void *cls, static void request_completed (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { fprintf (stderr, diff --git a/src/examples/demo.c b/src/examples/demo.c @@ -619,7 +619,7 @@ process_upload_data (void *cls, * * @param cls client-defined closure, NULL * @param connection connection handle - * @param con_cls value as set by the last call to + * @param req_cls value as set by the last call to * the MHD_AccessHandlerCallback, points to NULL if this was * not an upload * @param toe reason for request termination @@ -627,10 +627,10 @@ process_upload_data (void *cls, static void response_completed_callback (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct UploadContext *uc = *con_cls; + struct UploadContext *uc = *req_cls; (void) cls; /* Unused. Silent compiler warning. */ (void) connection; /* Unused. Silent compiler warning. */ (void) toe; /* Unused. Silent compiler warning. */ @@ -694,7 +694,7 @@ return_directory_response (struct MHD_Connection *connection) * @param version HTTP version * @param upload_data data from upload (PUT/POST) * @param upload_data_size number of bytes in @a upload_data - * @param ptr our context + * @param req_cls our context * @return #MHD_YES on success, #MHD_NO to drop connection */ static enum MHD_Result @@ -704,7 +704,7 @@ generate_page (void *cls, const char *method, const char *version, const char *upload_data, - size_t *upload_data_size, void **ptr) + size_t *upload_data_size, void **req_cls) { struct MHD_Response *response; enum MHD_Result ret; @@ -775,7 +775,7 @@ generate_page (void *cls, if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) { /* upload! */ - struct UploadContext *uc = *ptr; + struct UploadContext *uc = *req_cls; if (NULL == uc) { @@ -793,7 +793,7 @@ generate_page (void *cls, free (uc); return MHD_NO; } - *ptr = uc; + *req_cls = uc; return MHD_YES; } if (0 != *upload_data_size) diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c @@ -621,7 +621,7 @@ process_upload_data (void *cls, * * @param cls client-defined closure, NULL * @param connection connection handle - * @param con_cls value as set by the last call to + * @param req_cls value as set by the last call to * the MHD_AccessHandlerCallback, points to NULL if this was * not an upload * @param toe reason for request termination @@ -629,10 +629,10 @@ process_upload_data (void *cls, static void response_completed_callback (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct UploadContext *uc = *con_cls; + struct UploadContext *uc = *req_cls; (void) cls; /* Unused. Silent compiler warning. */ (void) connection; /* Unused. Silent compiler warning. */ (void) toe; /* Unused. Silent compiler warning. */ @@ -696,7 +696,7 @@ return_directory_response (struct MHD_Connection *connection) * @param version HTTP version * @param upload_data data from upload (PUT/POST) * @param upload_data_size number of bytes in "upload_data" - * @param ptr our context + * @param req_cls our context * @return #MHD_YES on success, #MHD_NO to drop connection */ static enum MHD_Result @@ -706,7 +706,7 @@ generate_page (void *cls, const char *method, const char *version, const char *upload_data, - size_t *upload_data_size, void **ptr) + size_t *upload_data_size, void **req_cls) { struct MHD_Response *response; enum MHD_Result ret; @@ -776,7 +776,7 @@ generate_page (void *cls, if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) { /* upload! */ - struct UploadContext *uc = *ptr; + struct UploadContext *uc = *req_cls; if (NULL == uc) { @@ -794,7 +794,7 @@ generate_page (void *cls, free (uc); return MHD_NO; } - *ptr = uc; + *req_cls = uc; return MHD_YES; } if (0 != *upload_data_size) diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c @@ -40,7 +40,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { struct MHD_Response *response; char *username; @@ -54,7 +54,7 @@ ahc_echo (void *cls, (void) version; /* Unused. Silent compiler warning. */ (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - (void) ptr; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ username = MHD_digest_auth_get_username (connection); if (NULL == username) diff --git a/src/examples/dual_stack_example.c b/src/examples/dual_stack_example.c @@ -34,7 +34,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { static int aptr; const char *me = cls; @@ -47,13 +47,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_buffer (strlen (me), (void *) me, MHD_RESPMEM_PERSISTENT); diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c @@ -48,7 +48,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, - size_t *upload_data_size, void **ptr) + size_t *upload_data_size, void **req_cls) { static int aptr; struct MHD_Response *response; @@ -63,13 +63,13 @@ ahc_echo (void *cls, if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) && (0 != strcmp (method, MHD_HTTP_METHOD_HEAD)) ) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ /* WARNING: direct usage of url as filename is for example only! * NEVER pass received data directly as parameter to file manipulation * functions. Always check validity of data before using. diff --git a/src/examples/fileserver_example_dirs.c b/src/examples/fileserver_example_dirs.c @@ -88,7 +88,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, - size_t *upload_data_size, void **ptr) + size_t *upload_data_size, void **req_cls) { static int aptr; struct MHD_Response *response; @@ -105,13 +105,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ file = fopen (&url[1], "rb"); if (NULL != file) diff --git a/src/examples/fileserver_example_external_select.c b/src/examples/fileserver_example_external_select.c @@ -55,7 +55,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, - size_t *upload_data_size, void **ptr) + size_t *upload_data_size, void **req_cls) { static int aptr; struct MHD_Response *response; @@ -70,13 +70,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ file = fopen (&url[1], "rb"); if (NULL != file) diff --git a/src/examples/http_chunked_compression.c b/src/examples/http_chunked_compression.c @@ -156,7 +156,7 @@ free_cb (void *cls) static enum MHD_Result ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_size, void **ptr) + const char *upload_data, size_t *upload_size, void **req_cls) { struct Holder *holder; struct MHD_Response *res; @@ -167,12 +167,12 @@ ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const (void) version; (void) upload_data; (void) upload_size; - if (NULL == *ptr) + if (NULL == *req_cls) { - *ptr = (void *) 1; + *req_cls = (void *) 1; return MHD_YES; } - *ptr = NULL; + *req_cls = NULL; holder = calloc (1, sizeof (struct Holder)); if (! holder) return MHD_NO; diff --git a/src/examples/http_compression.c b/src/examples/http_compression.c @@ -96,7 +96,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { struct MHD_Response *response; enum MHD_Result ret; @@ -111,12 +111,12 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (! *ptr) + if (! *req_cls) { - *ptr = (void *) 1; + *req_cls = (void *) 1; return MHD_YES; } - *ptr = NULL; + *req_cls = NULL; body_str = strdup (PAGE); if (NULL == body_str) diff --git a/src/examples/https_fileserver_example.c b/src/examples/https_fileserver_example.c @@ -137,7 +137,7 @@ http_ahc (void *cls, const char *method, const char *version, const char *upload_data, - size_t *upload_data_size, void **ptr) + size_t *upload_data_size, void **req_cls) { static int aptr; struct MHD_Response *response; @@ -152,13 +152,13 @@ http_ahc (void *cls, if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ file = fopen (&url[1], "rb"); if (NULL != file) diff --git a/src/examples/minimal_example.c b/src/examples/minimal_example.c @@ -36,7 +36,7 @@ ahc_echo (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; const char *me = cls; @@ -50,13 +50,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_buffer (strlen (me), (void *) me, MHD_RESPMEM_PERSISTENT); diff --git a/src/examples/minimal_example_comet.c b/src/examples/minimal_example_comet.c @@ -44,7 +44,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { static int aptr; struct MHD_Response *response; @@ -57,13 +57,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 80, &data_generator, NULL, NULL); diff --git a/src/examples/minimal_example_empty.c b/src/examples/minimal_example_empty.c @@ -34,7 +34,7 @@ ahc_echo (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct MHD_Response *response; @@ -48,13 +48,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); diff --git a/src/examples/minimal_example_empty_tls.c b/src/examples/minimal_example_empty_tls.c @@ -34,7 +34,7 @@ ahc_echo (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct MHD_Response *response; @@ -48,13 +48,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); diff --git a/src/examples/msgs_i18n.c b/src/examples/msgs_i18n.c @@ -51,7 +51,7 @@ ahc_echo (void *cls, const char *ver, const char *upd, size_t *upsz, - void **ptr) + void **req_cls) { return MHD_NO; } diff --git a/src/examples/post_example.c b/src/examples/post_example.c @@ -540,7 +540,7 @@ post_iterator (void *cls, * @param upload_data_size set initially to the size of the * upload_data provided; the method must update this * value to the number of bytes NOT processed; - * @param ptr pointer that the callback can set to some + * @param req_cls pointer that the callback can set to some * address and that will be preserved by MHD for future * calls for this request; since the access handler may * be called many times (i.e., for a PUT/POST operation @@ -549,7 +549,7 @@ post_iterator (void *cls, * If necessary, this state can be cleaned up in the * global "MHD_RequestCompleted" callback (which * can be set with the MHD_OPTION_NOTIFY_COMPLETED). - * Initially, <tt>*con_cls</tt> will be NULL. + * Initially, <tt>*req_cls</tt> will be NULL. * @return MHS_YES if the connection was handled successfully, * MHS_NO if the socket must be closed due to a serious * error while handling the request @@ -562,7 +562,7 @@ create_response (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { struct MHD_Response *response; struct Request *request; @@ -572,7 +572,7 @@ create_response (void *cls, (void) cls; /* Unused. Silent compiler warning. */ (void) version; /* Unused. Silent compiler warning. */ - request = *ptr; + request = *req_cls; if (NULL == request) { request = calloc (1, sizeof (struct Request)); @@ -581,7 +581,7 @@ create_response (void *cls, fprintf (stderr, "calloc error: %s\n", strerror (errno)); return MHD_NO; } - *ptr = request; + *req_cls = request; if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) { request->pp = MHD_create_post_processor (connection, 1024, @@ -660,16 +660,16 @@ create_response (void *cls, * * @param cls not used * @param connection connection that completed - * @param con_cls session handle + * @param req_cls session handle * @param toe status code */ static void request_completed_callback (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct Request *request = *con_cls; + struct Request *request = *req_cls; (void) cls; /* Unused. Silent compiler warning. */ (void) connection; /* Unused. Silent compiler warning. */ (void) toe; /* Unused. Silent compiler warning. */ diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c @@ -35,7 +35,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { static int aptr; const char *fmt = cls; @@ -51,13 +51,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ if (NULL == fmt) return MHD_NO; /* The cls must not be NULL */ 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 @@ -41,7 +41,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { static int aptr; const char *me = cls; @@ -56,9 +56,9 @@ ahc_echo (void *cls, if ((0 != strcmp (method, "GET")) && (0 != strcmp (method, "POST"))) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { - *ptr = &aptr; + *req_cls = &aptr; /* always to busy for POST requests */ if (0 == strcmp (method, "POST")) @@ -74,7 +74,7 @@ ahc_echo (void *cls, } } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_buffer (strlen (me), (void *) me, MHD_RESPMEM_PERSISTENT); diff --git a/src/examples/suspend_resume_epoll.c b/src/examples/suspend_resume_epoll.c @@ -49,7 +49,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { struct MHD_Response *response; enum MHD_Result ret; @@ -62,7 +62,7 @@ ahc_echo (void *cls, (void) version; /* Unused. Silence compiler warning. */ (void) upload_data; /* Unused. Silence compiler warning. */ (void) upload_data_size; /* Unused. Silence compiler warning. */ - req = *ptr; + req = *req_cls; if (NULL == req) { @@ -71,7 +71,7 @@ ahc_echo (void *cls, return MHD_NO; req->connection = connection; req->timerfd = -1; - *ptr = req; + *req_cls = req; return MHD_YES; } @@ -120,10 +120,10 @@ ahc_echo (void *cls, static void connection_done (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct Request *req = *con_cls; + struct Request *req = *req_cls; (void) cls; (void) connection; diff --git a/src/examples/timeout.c b/src/examples/timeout.c @@ -37,7 +37,7 @@ answer_to_connection (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { const char *page = "<html><body>Hello timeout!</body></html>"; struct MHD_Response *response; @@ -48,7 +48,7 @@ answer_to_connection (void *cls, (void) method; /* Unused. Silent compiler warning. */ (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - (void) con_cls; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ response = MHD_create_response_from_buffer (strlen (page), (void *) page, diff --git a/src/examples/upgrade_example.c b/src/examples/upgrade_example.c @@ -169,7 +169,7 @@ run_usock (void *cls) * @param connection original HTTP connection handle, * giving the function a last chance * to inspect the original HTTP request - * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` * @param extra_in if we happened to have read bytes after the * HTTP header already (because the client sent * more than the HTTP header of the request before @@ -194,7 +194,7 @@ run_usock (void *cls) static void uh_cb (void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, @@ -204,7 +204,7 @@ uh_cb (void *cls, pthread_t pt; (void) cls; /* Unused. Silent compiler warning. */ (void) connection; /* Unused. Silent compiler warning. */ - (void) con_cls; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ md = malloc (sizeof (struct MyData)); if (NULL == md) @@ -247,7 +247,7 @@ ahc_echo (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct MHD_Response *response; @@ -260,13 +260,13 @@ ahc_echo (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_for_upgrade (&uh_cb, NULL); diff --git a/src/examples/websocket_chatserver_example.c b/src/examples/websocket_chatserver_example.c @@ -2044,7 +2044,7 @@ connecteduser_receive_messages (void *cls) * @param connection original HTTP connection handle, * giving the function a last chance * to inspect the original HTTP request - * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` * @param extra_in if we happened to have read bytes after the * HTTP header already (because the client sent * more than the HTTP header of the request before @@ -2069,7 +2069,7 @@ connecteduser_receive_messages (void *cls) static void upgrade_handler (void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket fd, @@ -2079,7 +2079,7 @@ upgrade_handler (void *cls, pthread_t pt; (void) cls; /* Unused. Silent compiler warning. */ (void) connection; /* Unused. Silent compiler warning. */ - (void) con_cls; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ /* This callback must return as soon as possible. */ @@ -2130,7 +2130,7 @@ upgrade_handler (void *cls, * @param version The HTTP version * @param upload_data Given upload data for POST requests * @param upload_data_size The size of the upload data - * @param ptr A pointer for request specific data + * @param req_cls A pointer for request specific data * @return MHD_YES on success or MHD_NO on error. */ static enum MHD_Result @@ -2141,7 +2141,7 @@ access_handler (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct MHD_Response *response; @@ -2153,13 +2153,13 @@ access_handler (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ if (0 == strcmp (url, "/")) { /* Default page for visiting the server */ diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c @@ -763,7 +763,7 @@ run_usock (void *cls) static void -uh_cb (void *cls, struct MHD_Connection *con, void *con_cls, +uh_cb (void *cls, struct MHD_Connection *con, void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, struct MHD_UpgradeResponseHandle *urh) { @@ -774,7 +774,7 @@ uh_cb (void *cls, struct MHD_Connection *con, void *con_cls, (void) cls; /* Unused. Silent compiler warning. */ (void) con; /* Unused. Silent compiler warning. */ - (void) con_cls; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ (void) extra_in; /* Unused. Silent compiler warning. */ (void) extra_in_size; /* Unused. Silent compiler warning. */ @@ -814,7 +814,7 @@ uh_cb (void *cls, struct MHD_Connection *con, void *con_cls, static enum MHD_Result ahc_cb (void *cls, struct MHD_Connection *con, const char *url, const char *method, const char *version, const char *upload_data, - size_t *upload_data_size, void **ptr) + size_t *upload_data_size, void **req_cls) { struct MHD_Response *res; const char *upg_header; @@ -830,12 +830,12 @@ ahc_cb (void *cls, struct MHD_Connection *con, const char *url, (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - if (NULL == *ptr) + if (NULL == *req_cls) { - *ptr = (void *) 1; + *req_cls = (void *) 1; return MHD_YES; } - *ptr = NULL; + *req_cls = NULL; upg_header = MHD_lookup_connection_value (con, MHD_HEADER_KIND, MHD_HTTP_HEADER_UPGRADE); con_header = MHD_lookup_connection_value (con, MHD_HEADER_KIND, diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -1629,12 +1629,12 @@ enum MHD_OPTION * void * my_logger(void *cls, const char *uri, struct MHD_Connection *con) * * where the return value will be passed as - * (`* con_cls`) in calls to the #MHD_AccessHandlerCallback + * (`* req_cls`) in calls to the #MHD_AccessHandlerCallback * when this request is processed later; returning a * value of NULL has no special significance (however, * note that if you return non-NULL, you can no longer * rely on the first call to the access handler having - * `NULL == *con_cls` on entry;) + * `NULL == *req_cls` on entry;) * "cls" will be set to the second argument following * #MHD_OPTION_URI_LOG_CALLBACK. Finally, uri will * be the 0-terminated URI of the request. @@ -2252,10 +2252,10 @@ enum MHD_ConnectionInfoType /** * Returns the client-specific pointer to a `void *` that was (possibly) * set during a #MHD_NotifyConnectionCallback when the socket was - * first accepted. Note that this is NOT the same as the "con_cls" - * argument of the #MHD_AccessHandlerCallback. The "con_cls" is - * fresh for each HTTP request, while the "socket_context" is fresh - * for each socket. + * first accepted. + * Note that this is NOT the same as the "req_cls" argument of + * the #MHD_AccessHandlerCallback. The "req_cls" is fresh for each + * HTTP request, while the "socket_context" is fresh for each socket. */ MHD_CONNECTION_INFO_SOCKET_CONTEXT, @@ -2428,7 +2428,7 @@ typedef enum MHD_Result * @param[in,out] upload_data_size set initially to the size of the * @a upload_data provided; the method must update this * value to the number of bytes NOT processed; - * @param[in,out] con_cls pointer that the callback can set to some + * @param[in,out] req_cls pointer that the callback can set to some * address and that will be preserved by MHD for future * calls for this request; since the access handler may * be called many times (i.e., for a PUT/POST operation @@ -2437,7 +2437,7 @@ typedef enum MHD_Result * If necessary, this state can be cleaned up in the * global #MHD_RequestCompletedCallback (which * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). - * Initially, `*con_cls` will be NULL. + * Initially, `*req_cls` will be NULL. * @return #MHD_YES if the connection was handled successfully, * #MHD_NO if the socket must be closed due to a serious * error while handling the request @@ -2452,7 +2452,7 @@ typedef enum MHD_Result const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls); + void **req_cls); /** @@ -2461,7 +2461,7 @@ typedef enum MHD_Result * * @param cls client-defined closure * @param connection connection handle - * @param con_cls value as set by the last call to + * @param req_cls value as set by the last call to * the #MHD_AccessHandlerCallback * @param toe reason for request termination * @see #MHD_OPTION_NOTIFY_COMPLETED @@ -2470,7 +2470,7 @@ typedef enum MHD_Result typedef void (*MHD_RequestCompletedCallback) (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe); @@ -2483,7 +2483,7 @@ typedef void * @param socket_context socket-specific pointer where the * client can associate some state specific * to the TCP connection; note that this is - * different from the "con_cls" which is per + * different from the "req_cls" which is per * HTTP request. The client can initialize * during #MHD_CONNECTION_NOTIFY_STARTED and * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED @@ -3790,7 +3790,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, * @param connection original HTTP connection handle, * giving the function a last chance * to inspect the original HTTP request - * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` * @param extra_in if we happened to have read bytes after the * HTTP header already (because the client sent * more than the HTTP header of the request before @@ -3815,7 +3815,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, typedef void (*MHD_UpgradeHandler)(void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h @@ -2429,7 +2429,7 @@ enum MHD_ConnectionNotificationCode * @param socket_context socket-specific pointer where the * client can associate some state specific * to the TCP connection; note that this is - * different from the "con_cls" which is per + * different from the "req_cls" which is per * HTTP request. The client can initialize * during #MHD_CONNECTION_NOTIFY_STARTED and * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED @@ -3303,7 +3303,7 @@ MHD_NONNULL (1); * @param connection original HTTP connection handle, * giving the function a last chance * to inspect the original HTTP request - * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` * @param extra_in if we happened to have read bytes after the * HTTP header already (because the client sent * more than the HTTP header of the request before @@ -3328,7 +3328,7 @@ MHD_NONNULL (1); typedef void (*MHD_UpgradeHandler)(void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, @@ -3644,8 +3644,8 @@ enum MHD_ConnectionInformationType /** * Returns the client-specific pointer to a `void *` that was (possibly) * set during a #MHD_NotifyConnectionCallback when the socket was - * first accepted. Note that this is NOT the same as the "con_cls" - * argument of the #MHD_AccessHandlerCallback. The "con_cls" is + * first accepted. Note that this is NOT the same as the "req_cls" + * argument of the #MHD_AccessHandlerCallback. The "req_cls" is * fresh for each HTTP request, while the "socket_context" is fresh * for each socket. */ diff --git 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 static void term_cb (void *cls, struct MHD_Connection *c, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode term_code) { struct term_notif_cb_param *param = (struct term_notif_cb_param *) cls; - if (NULL == con_cls) - mhdErrorExitDesc ("'con_cls' pointer is NULL"); + if (NULL == req_cls) + mhdErrorExitDesc ("'req_cls' pointer is NULL"); if (NULL == c) mhdErrorExitDesc ("'connection' pointer is NULL"); if (NULL == param) @@ -1220,7 +1220,7 @@ ahcCheck (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { static int marker; enum MHD_Result ret; @@ -1273,13 +1273,13 @@ ahcCheck (void *cls, *upload_data_size = 0; } - if (&marker != *con_cls) + if (&marker != *req_cls) { /* The first call of the callback for this connection */ mhd_assert (NULL == upload_data); param->req_body_uploaded = 0; - *con_cls = ▮ + *req_cls = ▮ return MHD_YES; } diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c @@ -81,11 +81,11 @@ ahc_nothing (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { (void) cls; (void) connection; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ - (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ + (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ return MHD_NO; } diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c @@ -42,7 +42,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { (void) cls; (void) connection; @@ -51,7 +51,7 @@ ahc_echo (void *cls, (void) version; (void) upload_data; (void) upload_data_size; - (void) unused; + (void) req_cls; return 0; } diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c @@ -42,11 +42,11 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { (void) cls; (void) connection; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ - (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ + (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ return MHD_NO; } diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c @@ -628,14 +628,14 @@ term_reason_str (enum MHD_RequestTerminationCode term_code) * * @param cls client-defined closure * @param connection connection handle - * @param con_cls value as set by the last call to + * @param req_cls value as set by the last call to * the #MHD_AccessHandlerCallback * @param toe reason for request termination */ static void notify_completed_cb (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { (void) cls; @@ -647,15 +647,15 @@ notify_completed_cb (void *cls, (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) mhdErrorExitDesc ("notify_completed_cb() called with wrong code"); - if (NULL == con_cls) - mhdErrorExitDesc ("'con_cls' parameter is NULL"); - if (NULL == *con_cls) - mhdErrorExitDesc ("'*con_cls' pointer is NULL"); - if (! pthread_equal (**((pthread_t **) con_cls), + if (NULL == req_cls) + mhdErrorExitDesc ("'req_cls' parameter is NULL"); + if (NULL == *req_cls) + mhdErrorExitDesc ("'*req_cls' pointer is NULL"); + if (! pthread_equal (**((pthread_t **) req_cls), pthread_self ())) mhdErrorExitDesc ("notify_completed_cb() is called in wrong thread"); - free (*con_cls); - *con_cls = NULL; + free (*req_cls); + *req_cls = NULL; } @@ -700,7 +700,7 @@ log_cb (void *cls, * @param socket_context socket-specific pointer where the * client can associate some state specific * to the TCP connection; note that this is - * different from the "con_cls" which is per + * different from the "req_cls" which is per * HTTP request. The client can initialize * during #MHD_CONNECTION_NOTIFY_STARTED and * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED @@ -956,7 +956,7 @@ run_usock_client (void *cls) * @param connection original HTTP connection handle, * giving the function a last chance * to inspect the original HTTP request - * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` * @param extra_in if we happened to have read bytes after the * HTTP header already (because the client sent * more than the HTTP header of the request before @@ -981,7 +981,7 @@ run_usock_client (void *cls) static void upgrade_cb (void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, @@ -989,7 +989,7 @@ upgrade_cb (void *cls, { (void) cls; (void) connection; - (void) con_cls; + (void) req_cls; (void) extra_in; /* Unused. Silent compiler warning. */ usock = wr_create_from_plain_sckt (sock); @@ -1028,7 +1028,7 @@ upgrade_cb (void *cls, * @param upload_data_size set initially to the size of the * @a upload_data provided; the method must update this * value to the number of bytes NOT processed; - * @param con_cls pointer that the callback can set to some + * @param req_cls pointer that the callback can set to some * address and that will be preserved by MHD for future * calls for this request; since the access handler may * be called many times (i.e., for a PUT/POST operation @@ -1037,7 +1037,7 @@ upgrade_cb (void *cls, * If necessary, this state can be cleaned up in the * global #MHD_RequestCompletedCallback (which * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). - * Initially, `*con_cls` will be NULL. + * Initially, `*req_cls` will be NULL. * @return #MHD_YES if the connection was handled successfully, * #MHD_NO if the socket must be closed due to a serious * error while handling the request @@ -1050,7 +1050,7 @@ ahc_upgrade (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { struct MHD_Response *resp; (void) cls; @@ -1060,11 +1060,11 @@ ahc_upgrade (void *cls, (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ - if (NULL == con_cls) - mhdErrorExitDesc ("'con_cls' is NULL"); - if (NULL == *con_cls) - mhdErrorExitDesc ("'*con_cls' value is NULL"); - if (! pthread_equal (**((pthread_t **) con_cls), pthread_self ())) + if (NULL == req_cls) + mhdErrorExitDesc ("'req_cls' is NULL"); + if (NULL == *req_cls) + mhdErrorExitDesc ("'*req_cls' value is NULL"); + if (! pthread_equal (**((pthread_t **) req_cls), pthread_self ())) mhdErrorExitDesc ("ahc_upgrade() is called in wrong thread"); resp = MHD_create_response_for_upgrade (&upgrade_cb, NULL); diff --git 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) * * @param cls client-defined closure * @param connection connection handle - * @param con_cls value as set by the last call to + * @param req_cls value as set by the last call to * the #MHD_AccessHandlerCallback * @param toe reason for request termination */ static void notify_completed_cb (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { (void) cls; @@ -815,15 +815,15 @@ notify_completed_cb (void *cls, (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) mhdErrorExitDesc ("notify_completed_cb() called with wrong code"); - if (NULL == con_cls) - mhdErrorExitDesc ("'con_cls' parameter is NULL"); - if (NULL == *con_cls) - mhdErrorExitDesc ("'*con_cls' pointer is NULL"); - if (! pthread_equal (**((pthread_t **) con_cls), + if (NULL == req_cls) + mhdErrorExitDesc ("'req_cls' parameter is NULL"); + if (NULL == *req_cls) + mhdErrorExitDesc ("'*req_cls' pointer is NULL"); + if (! pthread_equal (**((pthread_t **) req_cls), pthread_self ())) mhdErrorExitDesc ("notify_completed_cb() is called in wrong thread"); - free (*con_cls); - *con_cls = NULL; + free (*req_cls); + *req_cls = NULL; } @@ -868,7 +868,7 @@ log_cb (void *cls, * @param socket_context socket-specific pointer where the * client can associate some state specific * to the TCP connection; note that this is - * different from the "con_cls" which is per + * different from the "req_cls" which is per * HTTP request. The client can initialize * during #MHD_CONNECTION_NOTIFY_STARTED and * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED @@ -1139,7 +1139,7 @@ run_usock_client (void *cls) * @param connection original HTTP connection handle, * giving the function a last chance * to inspect the original HTTP request - * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param req_cls last value left in `req_cls` of the `MHD_AccessHandlerCallback` * @param extra_in if we happened to have read bytes after the * HTTP header already (because the client sent * more than the HTTP header of the request before @@ -1164,7 +1164,7 @@ run_usock_client (void *cls) static void upgrade_cb (void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket sock, @@ -1172,7 +1172,7 @@ upgrade_cb (void *cls, { (void) cls; (void) connection; - (void) con_cls; + (void) req_cls; (void) extra_in; /* Unused. Silent compiler warning. */ usock = wr_create_from_plain_sckt (sock); @@ -1211,7 +1211,7 @@ upgrade_cb (void *cls, * @param upload_data_size set initially to the size of the * @a upload_data provided; the method must update this * value to the number of bytes NOT processed; - * @param con_cls pointer that the callback can set to some + * @param req_cls pointer that the callback can set to some * address and that will be preserved by MHD for future * calls for this request; since the access handler may * be called many times (i.e., for a PUT/POST operation @@ -1220,7 +1220,7 @@ upgrade_cb (void *cls, * If necessary, this state can be cleaned up in the * global #MHD_RequestCompletedCallback (which * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). - * Initially, `*con_cls` will be NULL. + * Initially, `*req_cls` will be NULL. * @return #MHD_YES if the connection was handled successfully, * #MHD_NO if the socket must be closed due to a serious * error while handling the request @@ -1233,7 +1233,7 @@ ahc_upgrade (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { struct MHD_Response *resp; (void) cls; @@ -1243,11 +1243,11 @@ ahc_upgrade (void *cls, (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ - if (NULL == con_cls) - mhdErrorExitDesc ("'con_cls' is NULL"); - if (NULL == *con_cls) - mhdErrorExitDesc ("'*con_cls' value is NULL"); - if (! pthread_equal (**((pthread_t **) con_cls), pthread_self ())) + if (NULL == req_cls) + mhdErrorExitDesc ("'req_cls' is NULL"); + if (NULL == *req_cls) + mhdErrorExitDesc ("'*req_cls' value is NULL"); + if (! pthread_equal (**((pthread_t **) req_cls), pthread_self ())) mhdErrorExitDesc ("ahc_upgrade() is called in wrong thread"); resp = MHD_create_response_for_upgrade (&upgrade_cb, NULL); diff --git 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); static void upgrade_handler (void *cls, struct MHD_Connection *connection, - void *con_cls, + void *req_cls, const char *extra_in, size_t extra_in_size, MHD_socket fd, @@ -404,7 +404,7 @@ access_handler (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct MHD_Response *response; @@ -416,13 +416,13 @@ access_handler (void *cls, if (0 != strcmp (method, "GET")) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ if (0 == strcmp (url, "/")) { diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c @@ -45,12 +45,12 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { struct MHD_Response *response; enum MHD_Result ret; (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ - (void) upload_data; (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ + (void) upload_data; (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c @@ -99,7 +99,7 @@ ahc_empty (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; struct MHD_Response *response; @@ -114,12 +114,12 @@ ahc_empty (void *cls, if (0 != strcmp ("GET", method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); diff --git 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, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct MHD_Response *response; @@ -105,13 +105,13 @@ iovec_ahc (void *cls, if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ /* Create some test data. */ if (NULL == (data = malloc (TESTSTR_SIZE))) @@ -248,7 +248,7 @@ ahc_empty (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; struct MHD_Response *response; @@ -264,12 +264,12 @@ ahc_empty (void *cls, if (0 != strcmp ("GET", method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; iov.iov_base = NULL; iov.iov_len = 0; diff --git 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, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -56,12 +56,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (strlen (url), (void *) url, MHD_RESPMEM_MUST_COPY); diff --git 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 query_session_ahc (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 **ptr) + size_t *upload_data_size, void **req_cls) { struct MHD_Response *response; enum MHD_Result ret; @@ -55,9 +55,9 @@ query_session_ahc (void *cls, struct MHD_Connection *connection, (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ - if (NULL == *ptr) + if (NULL == *req_cls) { - *ptr = (void *) &query_session_ahc; + *req_cls = (void *) &query_session_ahc; return MHD_YES; } diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c @@ -207,7 +207,7 @@ http_ahc (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int aptr; struct MHD_Response *response; @@ -217,13 +217,13 @@ http_ahc (void *cls, if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } - *ptr = NULL; /* reset when done */ + *req_cls = NULL; /* reset when done */ response = MHD_create_response_from_buffer (strlen (test_data), (void *) test_data, MHD_RESPMEM_PERSISTENT); @@ -242,7 +242,7 @@ http_dummy_ahc (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { (void) cls; (void) connection; @@ -251,7 +251,7 @@ http_dummy_ahc (void *cls, (void) version; /* Unused. Silent compiler warning. */ (void) upload_data; (void) upload_data_size; - (void) ptr; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ return 0; } diff --git 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); enum MHD_Result http_ahc (void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *upload_data, - const char *version, size_t *upload_data_size, void **ptr); + const char *version, size_t *upload_data_size, void **req_cls); enum MHD_Result http_dummy_ahc (void *cls, struct MHD_Connection *connection, const char *url, const char *method, const char *upload_data, const char *version, size_t *upload_data_size, - void **ptr); + void **req_cls); /** diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c @@ -168,7 +168,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -178,12 +178,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; ret = MHD_queue_response (connection, MHD_HTTP_OK, response); if (ret == MHD_NO) abort (); diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c @@ -159,7 +159,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -169,12 +169,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; ret = MHD_queue_response (connection, MHD_HTTP_OK, response); if (ret == MHD_NO) abort (); diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c @@ -148,7 +148,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -161,12 +161,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; v = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "a"); diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c @@ -69,7 +69,7 @@ callback (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { struct callback_closure *cbc = calloc (1, sizeof(struct callback_closure)); struct MHD_Response *r; @@ -81,7 +81,7 @@ callback (void *cls, (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; - (void) con_cls; /* Unused. Silent compiler warning. */ + (void) req_cls; /* Unused. Silent compiler warning. */ if (NULL == cbc) return MHD_NO; diff --git a/src/testcurl/test_concurrent_stop.c b/src/testcurl/test_concurrent_stop.c @@ -143,7 +143,7 @@ ahc_echo (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **usr_data) + void **req_cls) { static int marker; const char *me = cls; @@ -153,12 +153,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&marker != *usr_data) + if (&marker != *req_cls) { - *usr_data = ▮ + *req_cls = ▮ return MHD_YES; } - *usr_data = NULL; + *req_cls = NULL; ret = MHD_queue_response (connection, MHD_HTTP_OK, response); diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c @@ -90,12 +90,12 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { int *done = cls; struct MHD_Response *response; enum MHD_Result ret; - (void) version; (void) unused; /* Unused. Silent compiler warning. */ + (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp ("DELETE", method)) return MHD_NO; /* unexpected method */ diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c @@ -86,7 +86,7 @@ ahc_echo (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { struct MHD_Response *response; char *username; @@ -96,7 +96,7 @@ ahc_echo (void *cls, int ret_i; (void) cls; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ - (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ + (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ username = MHD_digest_auth_get_username (connection); if ( (username == NULL) || diff --git a/src/testcurl/test_digestauth_sha256.c b/src/testcurl/test_digestauth_sha256.c @@ -87,7 +87,7 @@ ahc_echo (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { struct MHD_Response *response; char *username; @@ -97,7 +97,7 @@ ahc_echo (void *cls, int ret_i; (void) cls; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ - (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ + (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ username = MHD_digest_auth_get_username (connection); if ( (username == NULL) || diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c @@ -80,7 +80,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { struct MHD_Response *response; char *username; @@ -90,7 +90,7 @@ ahc_echo (void *cls, int ret_i; (void) cls; (void) url; /* Unused. Silent compiler warning. */ (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ - (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ + (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ username = MHD_digest_auth_get_username (connection); if ( (username == NULL) || diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c @@ -107,7 +107,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -120,12 +120,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; v = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "a"); @@ -745,7 +745,7 @@ ahc_empty (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; struct MHD_Response *response; @@ -759,12 +759,12 @@ ahc_empty (void *cls, if (0 != strcmp ("GET", method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c @@ -180,7 +180,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { static int aptr; const char *me = cls; @@ -194,10 +194,10 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } if (! resp_string) diff --git 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, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -324,12 +324,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; if (slow_reply) usleep (200000); diff --git a/src/testcurl/test_get_empty.c b/src/testcurl/test_get_empty.c @@ -107,7 +107,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -119,12 +119,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); @@ -703,7 +703,7 @@ ahc_empty (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; struct MHD_Response *response; @@ -717,12 +717,12 @@ ahc_empty (void *cls, if (0 != strcmp ("GET", method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); diff --git a/src/testcurl/test_get_iovec.c b/src/testcurl/test_get_iovec.c @@ -132,7 +132,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -146,12 +146,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; /* Create some test data. */ if (NULL == (data = malloc (TESTSTR_SIZE))) @@ -188,7 +188,7 @@ ncont_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -202,12 +202,12 @@ ncont_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; if (NULL == (iov = malloc (sizeof(struct MHD_IoVec) * TESTSTR_IOVCNT))) return MHD_NO; diff --git a/src/testcurl/test_get_response_cleanup.c b/src/testcurl/test_get_response_cleanup.c @@ -122,7 +122,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -134,12 +134,12 @@ ahc_echo (void *cls, // fprintf (stderr, "In CB: %s!\n", method); if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 32 * 1024, &push_callback, diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c @@ -84,7 +84,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -96,12 +96,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; fd = open (sourcefile, O_RDONLY); if (fd == -1) { diff --git a/src/testcurl/test_get_wait.c b/src/testcurl/test_get_wait.c @@ -86,7 +86,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -96,12 +96,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; ret = MHD_queue_response (connection, MHD_HTTP_OK, response); if (ret == MHD_NO) abort (); diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c @@ -82,7 +82,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -92,12 +92,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (strlen (url), (void *) url, MHD_RESPMEM_MUST_COPY); diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c @@ -233,7 +233,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **pparam) + void **req_cls) { int *done = cls; struct MHD_Response *response; @@ -259,13 +259,13 @@ ahc_echo (void *cls, if ((*done) == 0) { size_t *pproc; - if (NULL == *pparam) + if (NULL == *req_cls) { processed = 0; /* Safe as long as only one parallel request served. */ - *pparam = &processed; + *req_cls = &processed; } - pproc = (size_t *) *pparam; + pproc = (size_t *) *req_cls; if (0 == *upload_data_size) return MHD_YES; /* No data to process. */ diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c @@ -78,13 +78,13 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { const char *me = cls; struct MHD_Response *response; enum MHD_Result ret; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ - (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ + (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ diff --git a/src/testcurl/test_parse_cookies.c b/src/testcurl/test_parse_cookies.c @@ -68,7 +68,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -79,12 +79,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name1"); if ((hdr == NULL) || (0 != strcmp (hdr, "var1"))) diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c @@ -90,12 +90,12 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { int *done = cls; struct MHD_Response *response; enum MHD_Result ret; - (void) version; (void) unused; /* Unused. Silent compiler warning. */ + (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp ("PATCH", method)) return MHD_NO; /* unexpected method */ diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c @@ -69,15 +69,15 @@ struct CBC static void completed_cb (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct MHD_PostProcessor *pp = *con_cls; + struct MHD_PostProcessor *pp = *req_cls; (void) cls; (void) connection; (void) toe; /* Unused. Silent compiler warning. */ if (NULL != pp) MHD_destroy_post_processor (pp); - *con_cls = NULL; + *req_cls = NULL; } @@ -129,7 +129,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int eok; struct MHD_Response *response; @@ -142,12 +142,12 @@ ahc_echo (void *cls, printf ("METHOD: %s\n", method); return MHD_NO; /* unexpected method */ } - pp = *unused; + pp = *req_cls; if (pp == NULL) { eok = 0; pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); - *unused = pp; + *req_cls = pp; } MHD_post_process (pp, upload_data, *upload_data_size); if ((eok == 3) && (0 == *upload_data_size)) @@ -158,7 +158,7 @@ ahc_echo (void *cls, ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); MHD_destroy_post_processor (pp); - *unused = NULL; + *req_cls = NULL; return ret; } *upload_data_size = 0; @@ -592,7 +592,7 @@ ahc_cancel (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { struct MHD_Response *response; enum MHD_Result ret; @@ -606,9 +606,9 @@ ahc_cancel (void *cls, return MHD_NO; } - if (*unused == NULL) + if (*req_cls == NULL) { - *unused = "wibble"; + *req_cls = "wibble"; /* We don't want the body. Send a 500. */ response = MHD_create_response_from_buffer (0, NULL, MHD_RESPMEM_PERSISTENT); diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c @@ -86,7 +86,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **mptr) + void **req_cls) { static int marker; struct MHD_Response *response; @@ -99,21 +99,21 @@ ahc_echo (void *cls, printf ("METHOD: %s\n", method); return MHD_NO; /* unexpected method */ } - if ((*mptr != NULL) && (0 == *upload_data_size)) + if ((*req_cls != NULL) && (0 == *upload_data_size)) { - if (*mptr != &marker) + if (*req_cls != &marker) abort (); response = MHD_create_response_from_buffer (2, "OK", MHD_RESPMEM_PERSISTENT); ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); - *mptr = NULL; + *req_cls = NULL; return ret; } if (strlen (POST_DATA) != *upload_data_size) return MHD_YES; *upload_data_size = 0; - *mptr = ▮ + *req_cls = ▮ return MHD_YES; } diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c @@ -65,15 +65,15 @@ struct CBC static void completed_cb (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct MHD_PostProcessor *pp = *con_cls; + struct MHD_PostProcessor *pp = *req_cls; (void) cls; (void) connection; (void) toe; /* Unused. Silent compiler warning. */ if (NULL != pp) MHD_destroy_post_processor (pp); - *con_cls = NULL; + *req_cls = NULL; } @@ -128,7 +128,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int eok; struct MHD_Response *response; @@ -141,14 +141,14 @@ ahc_echo (void *cls, printf ("METHOD: %s\n", method); return MHD_NO; /* unexpected method */ } - pp = *unused; + pp = *req_cls; if (pp == NULL) { eok = 0; pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); if (pp == NULL) abort (); - *unused = pp; + *req_cls = pp; } MHD_post_process (pp, upload_data, *upload_data_size); if ((eok == 3) && (0 == *upload_data_size)) @@ -159,7 +159,7 @@ ahc_echo (void *cls, ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); MHD_destroy_post_processor (pp); - *unused = NULL; + *req_cls = NULL; return ret; } *upload_data_size = 0; diff --git a/src/testcurl/test_process_arguments.c b/src/testcurl/test_process_arguments.c @@ -69,7 +69,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -80,12 +80,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; hdr = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "k"); if ((hdr == NULL) || (0 != strcmp (hdr, "v x"))) abort (); diff --git a/src/testcurl/test_process_headers.c b/src/testcurl/test_process_headers.c @@ -89,7 +89,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -100,12 +100,12 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; ret = 0; MHD_get_connection_values (connection, MHD_HEADER_KIND, &kv_cb, &ret); if (ret != 1) diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c @@ -90,12 +90,12 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { int *done = cls; struct MHD_Response *response; enum MHD_Result ret; - (void) version; (void) unused; /* Unused. Silent compiler warning. */ + (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp ("PUT", method)) return MHD_NO; /* unexpected method */ diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c @@ -90,13 +90,13 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { int *done = cls; struct MHD_Response *response; enum MHD_Result ret; int have; - (void) version; (void) unused; /* Unused. Silent compiler warning. */ + (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp ("PUT", method)) return MHD_NO; /* unexpected method */ diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c @@ -193,7 +193,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -205,12 +205,12 @@ ahc_echo (void *cls, fprintf (stderr, "Unexpected HTTP method '%s'. ", method); externalErrorExit (); } - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (strlen (url), (void *) url, MHD_RESPMEM_MUST_COPY); @@ -229,10 +229,10 @@ ahc_echo (void *cls, static void request_completed (void *cls, struct MHD_Connection *connection, - void **con_cls, enum MHD_RequestTerminationCode code) + void **req_cls, enum MHD_RequestTerminationCode code) { int *done = (int *) cls; - (void) connection; (void) con_cls; (void) code; /* Unused. Silent compiler warning. */ + (void) connection; (void) req_cls; (void) code; /* Unused. Silent compiler warning. */ if (MHD_REQUEST_TERMINATED_COMPLETED_OK != code) { fprintf (stderr, "Unexpected termination code: %d. ", (int) code); diff --git a/src/testcurl/test_quiesce_stream.c b/src/testcurl/test_quiesce_stream.c @@ -142,7 +142,7 @@ http_AccessHandlerCallback (void *cls, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { enum MHD_Result ret; struct MHD_Response *response; @@ -151,7 +151,7 @@ http_AccessHandlerCallback (void *cls, (void) upload_data_size; /* Unused. Silent compiler warning. */ /* Never respond on first call */ - if (NULL == *con_cls) + if (NULL == *req_cls) { struct ContentReaderUserdata *userdata; fprintf (stderr, @@ -164,7 +164,7 @@ http_AccessHandlerCallback (void *cls, return MHD_NO; userdata->bytes_written = 0; userdata->connection = connection; - *con_cls = userdata; + *req_cls = userdata; return MHD_YES; } @@ -173,7 +173,7 @@ http_AccessHandlerCallback (void *cls, = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 32 * 1024, &http_ContentReaderCallback, - *con_cls, + *req_cls, &free_crc_data); ret = MHD_queue_response (connection, MHD_HTTP_OK, diff --git a/src/testcurl/test_termination.c b/src/testcurl/test_termination.c @@ -56,7 +56,7 @@ connection_handler (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **ptr) + void **req_cls) { static int i; struct MHD_Response *response; @@ -65,9 +65,9 @@ connection_handler (void *cls, (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ (void) upload_data_size; /* Unused. Silent compiler warning. */ - if (*ptr == NULL) + if (*req_cls == NULL) { - *ptr = &i; + *req_cls = &i; return MHD_YES; } diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c @@ -96,11 +96,11 @@ struct CBC static void termination_cb (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { int *test = cls; - (void) connection; (void) con_cls; /* Unused. Silent compiler warning. */ + (void) connection; (void) req_cls; /* Unused. Silent compiler warning. */ switch (toe) { @@ -190,12 +190,12 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { int *done = cls; struct MHD_Response *response; enum MHD_Result ret; - (void) version; (void) unused; /* Unused. Silent compiler warning. */ + (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ if (0 != strcmp ("PUT", method)) return MHD_NO; /* unexpected method */ diff --git a/src/testcurl/test_toolarge.c b/src/testcurl/test_toolarge.c @@ -448,7 +448,7 @@ ahcCheck (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { static int ptr; struct MHD_Response *response; @@ -477,12 +477,12 @@ ahcCheck (void *cls, if (0 != strcmp (param->rq_method, method)) mhdErrorExitDesc ("Unexpected request method"); - if (&ptr != *con_cls) + if (&ptr != *req_cls) { - *con_cls = &ptr; + *req_cls = &ptr; return MHD_YES; } - *con_cls = NULL; + *req_cls = NULL; if (1 > MHD_get_connection_values_n (connection, MHD_HEADER_KIND, &headerCheckerInterator, diff --git a/src/testcurl/test_tricky.c b/src/testcurl/test_tricky.c @@ -385,7 +385,7 @@ ahcCheck (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **con_cls) + void **req_cls) { static int ptr; struct MHD_Response *response; @@ -413,12 +413,12 @@ ahcCheck (void *cls, if (0 != strcmp (param->rq_method, method)) mhdErrorExitDesc ("Unexpected request method"); - if (&ptr != *con_cls) + if (&ptr != *req_cls) { - *con_cls = &ptr; + *req_cls = &ptr; return MHD_YES; } - *con_cls = NULL; + *req_cls = NULL; if (1 > MHD_get_connection_values_n (connection, MHD_HEADER_KIND, &headerCheckerInterator, diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c @@ -98,7 +98,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -108,16 +108,16 @@ ahc_echo (void *cls, if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } MHD_get_connection_values (connection, MHD_GET_ARGUMENT_KIND, &test_values, NULL); - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (strlen (url), (void *) url, MHD_RESPMEM_MUST_COPY); diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c @@ -67,7 +67,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int ptr; const char *me = cls; @@ -87,12 +87,12 @@ ahc_echo (void *cls, fprintf (stderr, "Upload data is NULL with non-zero size.\n"); if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&ptr != *unused) + if (&ptr != *req_cls) { - *unused = &ptr; + *req_cls = &ptr; return MHD_YES; } - *unused = NULL; + *req_cls = NULL; response = MHD_create_response_from_buffer (strlen (url), (void *) url, MHD_RESPMEM_MUST_COPY); diff --git a/src/testzzuf/test_get_chunked.c b/src/testzzuf/test_get_chunked.c @@ -95,7 +95,7 @@ ahc_echo (void *cls, const char *url, const char *method, const char *version, - const char *upload_data, size_t *upload_data_size, void **ptr) + const char *upload_data, size_t *upload_data_size, void **req_cls) { static int aptr; const char *me = cls; @@ -120,10 +120,10 @@ ahc_echo (void *cls, fprintf (stderr, "Upload data is NULL with non-zero size.\n"); if (0 != strcmp (me, method)) return MHD_NO; /* unexpected method */ - if (&aptr != *ptr) + if (&aptr != *req_cls) { /* do never respond on first call */ - *ptr = &aptr; + *req_cls = &aptr; return MHD_YES; } responseptr = malloc (sizeof (struct MHD_Response *)); diff --git a/src/testzzuf/test_long_header.c b/src/testzzuf/test_long_header.c @@ -77,13 +77,13 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { const char *me = cls; struct MHD_Response *response; enum MHD_Result ret; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ - (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ + (void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */ if (NULL == url) fprintf (stderr, "The \"url\" parameter is NULL.\n"); diff --git a/src/testzzuf/test_post.c b/src/testzzuf/test_post.c @@ -54,15 +54,15 @@ struct CBC static void completed_cb (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct MHD_PostProcessor *pp = *con_cls; + struct MHD_PostProcessor *pp = *req_cls; (void) cls; (void) connection; (void) toe; /* Unused. Silent compiler warning. */ if (NULL != pp) MHD_destroy_post_processor (pp); - *con_cls = NULL; + *req_cls = NULL; } @@ -114,7 +114,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int eok; struct MHD_Response *response; @@ -136,12 +136,12 @@ ahc_echo (void *cls, { return MHD_NO; /* unexpected method */ } - pp = *unused; + pp = *req_cls; if (pp == NULL) { eok = 0; pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); - *unused = pp; + *req_cls = pp; } MHD_post_process (pp, upload_data, *upload_data_size); if ((eok == 3) && (0 == *upload_data_size)) @@ -152,7 +152,7 @@ ahc_echo (void *cls, ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); MHD_destroy_post_processor (pp); - *unused = NULL; + *req_cls = NULL; return ret; } *upload_data_size = 0; diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c @@ -52,15 +52,15 @@ struct CBC static void completed_cb (void *cls, struct MHD_Connection *connection, - void **con_cls, + void **req_cls, enum MHD_RequestTerminationCode toe) { - struct MHD_PostProcessor *pp = *con_cls; + struct MHD_PostProcessor *pp = *req_cls; (void) cls; (void) connection; (void) toe; /* Unused. Silent compiler warning. */ if (NULL != pp) MHD_destroy_post_processor (pp); - *con_cls = NULL; + *req_cls = NULL; } @@ -117,7 +117,7 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { static int eok; struct MHD_Response *response; @@ -139,14 +139,14 @@ ahc_echo (void *cls, { return MHD_NO; /* unexpected method */ } - pp = *unused; + pp = *req_cls; if (pp == NULL) { eok = 0; pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); if (pp == NULL) return MHD_NO; - *unused = pp; + *req_cls = pp; } MHD_post_process (pp, upload_data, *upload_data_size); if ((eok == 3) && (0 == *upload_data_size)) @@ -157,7 +157,7 @@ ahc_echo (void *cls, ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); MHD_destroy_post_processor (pp); - *unused = NULL; + *req_cls = NULL; return ret; } *upload_data_size = 0; diff --git a/src/testzzuf/test_put.c b/src/testzzuf/test_put.c @@ -83,12 +83,12 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { int *done = cls; struct MHD_Response *response; enum MHD_Result ret; - (void) version; (void) unused; /* Unused. Silent compiler warning. */ + (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ if (NULL == url) fprintf (stderr, "The \"url\" parameter is NULL.\n"); diff --git a/src/testzzuf/test_put_chunked.c b/src/testzzuf/test_put_chunked.c @@ -83,13 +83,13 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { int *done = cls; struct MHD_Response *response; enum MHD_Result ret; int have; - (void) version; (void) unused; /* Unused. Silent compiler warning. */ + (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ if (NULL == url) fprintf (stderr, "The \"url\" parameter is NULL.\n"); diff --git a/src/testzzuf/test_put_large.c b/src/testzzuf/test_put_large.c @@ -91,12 +91,12 @@ ahc_echo (void *cls, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, - void **unused) + void **req_cls) { int *done = cls; struct MHD_Response *response; enum MHD_Result ret; - (void) version; (void) unused; /* Unused. Silent compiler warning. */ + (void) version; (void) req_cls; /* Unused. Silent compiler warning. */ if (NULL == url) fprintf (stderr, "The \"url\" parameter is NULL.\n");