aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/test_upgrade_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/test_upgrade_common.c')
-rw-r--r--src/microhttpd/test_upgrade_common.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/microhttpd/test_upgrade_common.c b/src/microhttpd/test_upgrade_common.c
index 1b5a6470..f04288d1 100644
--- a/src/microhttpd/test_upgrade_common.c
+++ b/src/microhttpd/test_upgrade_common.c
@@ -315,25 +315,14 @@ run_usock_client (void *cls)
315 * successfully and the socket should now be controlled by some 315 * successfully and the socket should now be controlled by some
316 * protocol other than HTTP. 316 * protocol other than HTTP.
317 * 317 *
318 * Any data received on the socket will be made available in 318 * Any data already received on the socket will be made available in
319 * 'data_in'. The function should update 'data_in_size' to 319 * @e extra_in. This can happen if the application sent extra data
320 * reflect the number of bytes consumed from 'data_in' (the remaining 320 * before MHD send the upgrade response. The application should
321 * bytes will be made available in the next call to the handler). 321 * treat data from @a extra_in as if it had read it from the socket.
322 * 322 *
323 * Any data that should be transmitted on the socket should be 323 * Note that the application must not close() @a sock directly,
324 * stored in 'data_out'. '*data_out_size' is initially set to 324 * but instead use #MHD_upgrade_action() for special operations
325 * the available buffer space in 'data_out'. It should be set to 325 * on @a sock.
326 * the number of bytes stored in 'data_out' (which can be zero).
327 *
328 * The return value is a BITMASK that indicates how the function
329 * intends to interact with the event loop. It can request to be
330 * notified for reading, writing, request to UNCORK the send buffer
331 * (which MHD is allowed to ignore, if it is not possible to uncork on
332 * the local platform), to wait for the 'external' select loop to
333 * trigger another round. It is also possible to specify "no events"
334 * to terminate the connection; in this case, the
335 * #MHD_RequestCompletedCallback will be called and all resources of
336 * the connection will be released.
337 * 326 *
338 * Except when in 'thread-per-connection' mode, implementations 327 * Except when in 'thread-per-connection' mode, implementations
339 * of this function should never block (as it will still be called 328 * of this function should never block (as it will still be called
@@ -343,7 +332,7 @@ run_usock_client (void *cls)
343 * @param connection original HTTP connection handle, 332 * @param connection original HTTP connection handle,
344 * giving the function a last chance 333 * giving the function a last chance
345 * to inspect the original HTTP request 334 * to inspect the original HTTP request
346 * @param con_cls last value left in `*con_cls` in the `MHD_AccessHandlerCallback` 335 * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback`
347 * @param extra_in if we happened to have read bytes after the 336 * @param extra_in if we happened to have read bytes after the
348 * HTTP header already (because the client sent 337 * HTTP header already (because the client sent
349 * more than the HTTP header of the request before 338 * more than the HTTP header of the request before
@@ -357,10 +346,13 @@ run_usock_client (void *cls)
357 * that is directly connected to the client and thus certain 346 * that is directly connected to the client and thus certain
358 * operations (TCP-specific setsockopt(), getsockopt(), etc.) 347 * operations (TCP-specific setsockopt(), getsockopt(), etc.)
359 * may not work as expected (as the socket could be from a 348 * may not work as expected (as the socket could be from a
360 * socketpair() or a TCP-loopback) 349 * socketpair() or a TCP-loopback). The application is expected
350 * to perform read()/recv() and write()/send() calls on the socket.
351 * The application may also call shutdown(), but must not call
352 * close() directly.
361 * @param urh argument for #MHD_upgrade_action()s on this @a connection. 353 * @param urh argument for #MHD_upgrade_action()s on this @a connection.
362 * Applications must eventually use this function to perform the 354 * Applications must eventually use this callback to (indirectly)
363 * close() action on the @a sock. 355 * perform the close() action on the @a sock.
364 */ 356 */
365static void 357static void
366upgrade_cb (void *cls, 358upgrade_cb (void *cls,
@@ -453,7 +445,6 @@ ahc_upgrade (void *cls,
453 * Run the MHD external event loop using select. 445 * Run the MHD external event loop using select.
454 * 446 *
455 * @param daemon daemon to run it for 447 * @param daemon daemon to run it for
456 * @param flags the flags the daemon was started with
457 */ 448 */
458static void 449static void
459run_mhd_select_loop (struct MHD_Daemon *daemon) 450run_mhd_select_loop (struct MHD_Daemon *daemon)
@@ -504,7 +495,6 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
504 * Run the MHD external event loop using select. 495 * Run the MHD external event loop using select.
505 * 496 *
506 * @param daemon daemon to run it for 497 * @param daemon daemon to run it for
507 * @param flags the flags the daemon was started with
508 */ 498 */
509static void 499static void
510run_mhd_poll_loop (struct MHD_Daemon *daemon) 500run_mhd_poll_loop (struct MHD_Daemon *daemon)
@@ -517,7 +507,6 @@ run_mhd_poll_loop (struct MHD_Daemon *daemon)
517 * Run the MHD external event loop using select. 507 * Run the MHD external event loop using select.
518 * 508 *
519 * @param daemon daemon to run it for 509 * @param daemon daemon to run it for
520 * @param flags the flags the daemon was started with
521 */ 510 */
522static void 511static void
523run_mhd_epoll_loop (struct MHD_Daemon *daemon) 512run_mhd_epoll_loop (struct MHD_Daemon *daemon)
@@ -557,7 +546,6 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
557 * Run the MHD external event loop using select. 546 * Run the MHD external event loop using select.
558 * 547 *
559 * @param daemon daemon to run it for 548 * @param daemon daemon to run it for
560 * @param flags the flags the daemon was started with
561 */ 549 */
562static void 550static void
563run_mhd_loop (struct MHD_Daemon *daemon, 551run_mhd_loop (struct MHD_Daemon *daemon,