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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 66a1650d..fa45f5f5 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -669,6 +669,17 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
669 int sv[2]; 669 int sv[2];
670 size_t rbo; 670 size_t rbo;
671 671
672 if (NULL ==
673 MHD_get_response_header (response,
674 MHD_HTTP_HEADER_UPGRADE))
675 {
676#ifdef HAVE_MESSAGES
677 MHD_DLOG (connection->daemon,
678 "Invalid response for upgrade: application failed to set the 'Upgrade' header!\n");
679#endif
680 return MHD_NO;
681 }
682
672 urh = malloc (sizeof (struct MHD_UpgradeResponseHandle)); 683 urh = malloc (sizeof (struct MHD_UpgradeResponseHandle));
673 if (NULL == urh) 684 if (NULL == urh)
674 return MHD_NO; 685 return MHD_NO;
@@ -704,6 +715,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response *response,
704 return MHD_YES; 715 return MHD_YES;
705 } 716 }
706#endif 717#endif
718 urh->connection = connection;
707 urh->app_socket = MHD_INVALID_SOCKET; 719 urh->app_socket = MHD_INVALID_SOCKET;
708 urh->mhd_socket = MHD_INVALID_SOCKET; 720 urh->mhd_socket = MHD_INVALID_SOCKET;
709 rbo = connection->read_buffer_offset; 721 rbo = connection->read_buffer_offset;
@@ -772,6 +784,14 @@ MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
772 response->upgrade_handler_cls = upgrade_handler_cls; 784 response->upgrade_handler_cls = upgrade_handler_cls;
773 response->total_size = MHD_SIZE_UNKNOWN; 785 response->total_size = MHD_SIZE_UNKNOWN;
774 response->reference_count = 1; 786 response->reference_count = 1;
787 if (MHD_NO ==
788 MHD_add_response_header (response,
789 MHD_HTTP_HEADER_CONNECTION,
790 "Upgrade"))
791 {
792 MHD_destroy_response (response);
793 return NULL;
794 }
775 return response; 795 return response;
776} 796}
777 797