aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/response.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/response.c')
-rw-r--r--src/microhttpd/response.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 93803813..5b67b983 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -603,6 +603,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
603 { 603 {
604 case MHD_UPGRADE_ACTION_CLOSE: 604 case MHD_UPGRADE_ACTION_CLOSE:
605 /* Application is done with this connection, tear it down! */ 605 /* Application is done with this connection, tear it down! */
606#if HTTPS_SUPPORT
606 if (0 != (daemon->options & MHD_USE_SSL) ) 607 if (0 != (daemon->options & MHD_USE_SSL) )
607 { 608 {
608 DLL_remove (daemon->urh_head, 609 DLL_remove (daemon->urh_head,
@@ -610,13 +611,14 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
610 urh); 611 urh);
611 /* FIXME: if running in epoll()-mode, do we have 612 /* FIXME: if running in epoll()-mode, do we have
612 to remove any of the FDs from any epoll-sets here? */ 613 to remove any of the FDs from any epoll-sets here? */
614 if ( (MHD_INVALID_SOCKET != urh->app_socket) &&
615 (0 != MHD_socket_close_ (urh->app_socket)) )
616 MHD_PANIC ("close failed\n");
617 if ( (MHD_INVALID_SOCKET != urh->mhd_socket) &&
618 (0 != MHD_socket_close_ (urh->mhd_socket)) )
619 MHD_PANIC ("close failed\n");
613 } 620 }
614 if ( (MHD_INVALID_SOCKET != urh->app_socket) && 621#endif
615 (0 != MHD_socket_close_ (urh->app_socket)) )
616 MHD_PANIC ("close failed\n");
617 if ( (MHD_INVALID_SOCKET != urh->mhd_socket) &&
618 (0 != MHD_socket_close_ (urh->mhd_socket)) )
619 MHD_PANIC ("close failed\n");
620 MHD_resume_connection (urh->connection); 622 MHD_resume_connection (urh->connection);
621 MHD_connection_close_ (urh->connection, 623 MHD_connection_close_ (urh->connection,
622 MHD_REQUEST_TERMINATED_COMPLETED_OK); 624 MHD_REQUEST_TERMINATED_COMPLETED_OK);
@@ -665,6 +667,9 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
665 urh = malloc (sizeof (struct MHD_UpgradeResponseHandle)); 667 urh = malloc (sizeof (struct MHD_UpgradeResponseHandle));
666 if (NULL == urh) 668 if (NULL == urh)
667 return MHD_NO; 669 return MHD_NO;
670 urh->connection = connection;
671 rbo = connection->read_buffer_offset;
672 connection->read_buffer_offset = 0;
668#if HTTPS_SUPPORT 673#if HTTPS_SUPPORT
669 if (0 != (daemon->options & MHD_USE_SSL) ) 674 if (0 != (daemon->options & MHD_USE_SSL) )
670 { 675 {
@@ -696,9 +701,6 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
696 701
697 urh->app_socket = sv[0]; 702 urh->app_socket = sv[0];
698 urh->mhd_socket = sv[1]; 703 urh->mhd_socket = sv[1];
699 urh->connection = connection;
700 rbo = connection->read_buffer_offset;
701 connection->read_buffer_offset = 0;
702 response->upgrade_handler (response->upgrade_handler_cls, 704 response->upgrade_handler (response->upgrade_handler_cls,
703 connection, 705 connection,
704 connection->client_context, 706 connection->client_context,
@@ -720,12 +722,9 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
720 urh); 722 urh);
721 return MHD_YES; 723 return MHD_YES;
722 } 724 }
723#endif
724 urh->connection = connection;
725 urh->app_socket = MHD_INVALID_SOCKET; 725 urh->app_socket = MHD_INVALID_SOCKET;
726 urh->mhd_socket = MHD_INVALID_SOCKET; 726 urh->mhd_socket = MHD_INVALID_SOCKET;
727 rbo = connection->read_buffer_offset; 727#endif
728 connection->read_buffer_offset = 0;
729 response->upgrade_handler (response->upgrade_handler_cls, 728 response->upgrade_handler (response->upgrade_handler_cls,
730 connection, 729 connection,
731 connection->client_context, 730 connection->client_context,