aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-05-09 23:17:57 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-05-09 23:17:57 +0300
commit917342b3fb0547523f2b4c6e607bb2ffd9cacdfd (patch)
tree069ea7936aeb7976b7406ab1e09a65876e6b765f
parent7cb47792c7ab27b6fd4564874863f0a8e82a0ff6 (diff)
downloadlibmicrohttpd-917342b3fb0547523f2b4c6e607bb2ffd9cacdfd.tar.gz
libmicrohttpd-917342b3fb0547523f2b4c6e607bb2ffd9cacdfd.zip
Do not add "Connection: Keep-Alive" header for "upgrade" connections
-rw-r--r--ChangeLog4
-rw-r--r--src/microhttpd/connection.c11
2 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ed19ecc9..3d60111b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Tue May 9 23:16:00 MSK 2017
2 Fixed: Do not add "Connection: Keep-Alive" header for "upgrade"
3 connections. -EG
4
1Tue May 9 21:01:00 MSK 2017 5Tue May 9 21:01:00 MSK 2017
2 Fixed: check all "Connection" headers of request for "Close" and "Upgrade" 6 Fixed: check all "Connection" headers of request for "Close" and "Upgrade"
3 tokens instead of using only first "Connection" header with full string 7 tokens instead of using only first "Connection" header with full string
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 38d439ef..a987a97b 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1148,11 +1148,19 @@ build_header_response (struct MHD_Connection *connection)
1148 1148
1149 if (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY)) 1149 if (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY))
1150 connection->keepalive = MHD_CONN_MUST_CLOSE; 1150 connection->keepalive = MHD_CONN_MUST_CLOSE;
1151#ifdef UPGRADE_SUPPORT
1152 else if (NULL != connection->response->upgrade_handler)
1153 /* If this connection will not be "upgraded", it must be closed. */
1154 connection->keepalive = MHD_CONN_MUST_CLOSE;
1155#endif /* UPGRADE_SUPPORT */
1151 1156
1152 /* now analyze chunked encoding situation */ 1157 /* now analyze chunked encoding situation */
1153 connection->have_chunked_upload = false; 1158 connection->have_chunked_upload = false;
1154 1159
1155 if ( (MHD_SIZE_UNKNOWN == connection->response->total_size) && 1160 if ( (MHD_SIZE_UNKNOWN == connection->response->total_size) &&
1161#ifdef UPGRADE_SUPPORT
1162 (NULL == connection->response->upgrade_handler) &&
1163#endif /* UPGRADE_SUPPORT */
1156 (! response_has_close) && 1164 (! response_has_close) &&
1157 (! client_requested_close) ) 1165 (! client_requested_close) )
1158 { 1166 {
@@ -1244,6 +1252,9 @@ build_header_response (struct MHD_Connection *connection)
1244 (! response_has_close) && 1252 (! response_has_close) &&
1245 (MHD_NO == must_add_close) && 1253 (MHD_NO == must_add_close) &&
1246 (MHD_CONN_MUST_CLOSE != connection->keepalive) && 1254 (MHD_CONN_MUST_CLOSE != connection->keepalive) &&
1255#ifdef UPGRADE_SUPPORT
1256 (NULL == connection->response->upgrade_handler) &&
1257#endif /* UPGRADE_SUPPORT */
1247 (MHD_YES == keepalive_possible (connection)) ) 1258 (MHD_YES == keepalive_possible (connection)) )
1248 must_add_keep_alive = MHD_YES; 1259 must_add_keep_alive = MHD_YES;
1249 break; 1260 break;