diff options
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 945c3f69..5feca5e4 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -528,6 +528,9 @@ keepalive_possible (struct MHD_Connection *connection) | |||
528 | 528 | ||
529 | if (NULL == connection->version) | 529 | if (NULL == connection->version) |
530 | return MHD_NO; | 530 | return MHD_NO; |
531 | if ( (NULL != connection->response) && | ||
532 | (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) ) | ||
533 | return MHD_NO; | ||
531 | end = MHD_lookup_connection_value (connection, | 534 | end = MHD_lookup_connection_value (connection, |
532 | MHD_HEADER_KIND, | 535 | MHD_HEADER_KIND, |
533 | MHD_HTTP_HEADER_CONNECTION); | 536 | MHD_HTTP_HEADER_CONNECTION); |
@@ -596,6 +599,7 @@ add_extra_headers (struct MHD_Connection *connection) | |||
596 | /* 'close' header doesn't exist yet, see if we need to add one; | 599 | /* 'close' header doesn't exist yet, see if we need to add one; |
597 | if the client asked for a close, no need to start chunk'ing */ | 600 | if the client asked for a close, no need to start chunk'ing */ |
598 | if ( (NULL == client_close) && | 601 | if ( (NULL == client_close) && |
602 | (0 == (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) && | ||
599 | (MHD_YES == keepalive_possible (connection)) && | 603 | (MHD_YES == keepalive_possible (connection)) && |
600 | (0 == strcasecmp (connection->version, | 604 | (0 == strcasecmp (connection->version, |
601 | MHD_HTTP_VERSION_1_1)) ) | 605 | MHD_HTTP_VERSION_1_1)) ) |
@@ -662,13 +666,15 @@ add_extra_headers (struct MHD_Connection *connection) | |||
662 | MHD_HTTP_HEADER_CONTENT_LENGTH, buf); | 666 | MHD_HTTP_HEADER_CONTENT_LENGTH, buf); |
663 | } | 667 | } |
664 | } | 668 | } |
665 | if (MHD_YES == add_close) | 669 | if ( (MHD_YES == add_close) && |
670 | (0 == (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) ) | ||
666 | MHD_add_response_header (connection->response, | 671 | MHD_add_response_header (connection->response, |
667 | MHD_HTTP_HEADER_CONNECTION, | 672 | MHD_HTTP_HEADER_CONNECTION, |
668 | "close"); | 673 | "close"); |
669 | if ( (NULL == have_keepalive) && | 674 | if ( (NULL == have_keepalive) && |
670 | (NULL == have_close) && | 675 | (NULL == have_close) && |
671 | (MHD_NO == add_close) && | 676 | (MHD_NO == add_close) && |
677 | (0 == (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) && | ||
672 | (MHD_YES == keepalive_possible (connection)) ) | 678 | (MHD_YES == keepalive_possible (connection)) ) |
673 | MHD_add_response_header (connection->response, | 679 | MHD_add_response_header (connection->response, |
674 | MHD_HTTP_HEADER_CONNECTION, | 680 | MHD_HTTP_HEADER_CONNECTION, |