libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 16ac89f3beb982dab4f1552ffb94e637b45ca324
parent cc29f300ab768ac5f0c328858e785a87253fa912
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Tue, 17 Aug 2021 21:34:41 +0300

Fixed: avoid duplication of "close" token in replies

Diffstat:
Msrc/microhttpd/connection.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -1705,7 +1705,9 @@ buffer_append (char *buf, * @param kind the kind of objects (headers or footers) * @param filter_transf_enc skip "Transfer-Encoding" header * @param add_close add "close" token to the - * "Connection:" header (if any) + * "Connection:" header (if any), ignored if no "Connection:" + * header was added by user or if "close" token is already + * present in "Connection:" header * @param add_keep_alive add "Keep-Alive" token to the * "Connection:" header (if any) * @return true if succeed, @@ -1737,6 +1739,8 @@ add_user_headers (char *buf, add_close = false; /* No such header */ add_keep_alive = false; /* No such header */ } + else if (0 != (r->flags_auto & MHD_RAF_HAS_CONNECTION_CLOSE)) + add_close = false; /* "close" token was already set */ for (hdr = r->first_header; NULL != hdr; hdr = hdr->next) {