diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-08-28 08:41:46 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-08-28 08:41:46 +0000 |
commit | fd7feaf9161ae725d3dab83794b60d56d02be735 (patch) | |
tree | 943b2ca7bb30975685076ef1f5fa373e8710d39f | |
parent | 11171dc8c5741387a165bcf4f909c9c7af6e270e (diff) |
-fix ftbfs
-rw-r--r-- | src/microhttpd/internal.h | 58 | ||||
-rw-r--r-- | src/microhttpd/response.c | 32 |
2 files changed, 56 insertions, 34 deletions
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index a810d319..c1524330 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h @@ -147,22 +147,22 @@ enum MHD_ConnectionEventLoopInfo /** * We are waiting to be able to read. */ - MHD_EVENT_LOOP_INFO_READ = 0, + MHD_EVENT_LOOP_INFO_READ = 1, /** * We are waiting to be able to write. */ - MHD_EVENT_LOOP_INFO_WRITE = 1, + MHD_EVENT_LOOP_INFO_WRITE = 2, /** * We are waiting for the application to provide data. */ - MHD_EVENT_LOOP_INFO_BLOCK = 2, + MHD_EVENT_LOOP_INFO_BLOCK = 4, /** * We are finished and are awaiting cleanup. */ - MHD_EVENT_LOOP_INFO_CLEANUP = 3 + MHD_EVENT_LOOP_INFO_CLEANUP = 8 }; @@ -886,6 +886,56 @@ struct MHD_Connection int resuming; }; + +/** + * Handle given to the application to manage special + * actions relating to MHD responses that "upgrade" + * the HTTP protocol (i.e. to WebSockets). + */ +struct MHD_UpgradeResponseHandle +{ + + /** + * Kept in a DLL per daemon. + */ + struct MHD_UpgradeResponseHandle *next; + + /** + * Kept in a DLL per daemon. + */ + struct MHD_UpgradeResponseHandle *prev; + + /** + * The connection for which this is an upgrade handle. Note that + * because a response may be shared over many connections, this may + * not be the only upgrade handle for the response of this connection. + */ + struct MHD_Connection *connection; + + /** + * The socket we gave to the application (r/w). + */ + MHD_socket app_socket; + + /** + * IO-state of the @e app_socket. + */ + enum MHD_ConnectionEventLoopInfo celi_app; + + /** + * If @a app_sock was a socketpair, our end of it, otherwise + * #MHD_INVALID_SOCKET; (r/w). + */ + MHD_socket mhd_socket; + + /** + * IO-state of the @e mhd_socket. + */ + enum MHD_ConnectionEventLoopInfo celi_mhd; + +}; + + /** * Signature of function called to log URI accesses. * diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 9336aa91..e7049a5a 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c @@ -581,35 +581,6 @@ MHD_create_response_from_buffer (size_t size, /** - * Handle given to the application to manage special - * actions relating to MHD responses that "upgrade" - * the HTTP protocol (i.e. to WebSockets). - */ -struct MHD_UpgradeResponseHandle -{ - - /** - * The connection for which this is an upgrade handle. Note that - * because a response may be shared over many connections, this may - * not be the only upgrade handle for the response of this connection. - */ - struct MHD_Connection *connection; - - /** - * The socket we gave to the application (r/w). - */ - MHD_socket app_socket; - - /** - * If @a app_sock was a socketpair, our end of it, otherwise - * #MHD_INVALID_SOCKET; (r/w). - */ - MHD_socket mhd_socket; - -}; - - -/** * This connection-specific callback is provided by MHD to * applications (unusual) during the #MHD_UpgradeHandler. * It allows applications to perform 'special' actions on @@ -702,7 +673,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response, connection->read_buffer_offset = 0; response->upgrade_handler (response->upgrade_handler_cls, connection, - connection->con_cls, + connection->client_context, connection->read_buffer, rbo, urh->app_socket, @@ -723,6 +694,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response, connection->read_buffer_offset = 0; response->upgrade_handler (response->upgrade_handler_cls, connection, + connection->client_context, connection->read_buffer, rbo, connection->socket_fd, |