[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 03/07: response: use auto flag for chunked encoding head
From: |
gnunet |
Subject: |
[libmicrohttpd] 03/07: response: use auto flag for chunked encoding header |
Date: |
Wed, 28 Jul 2021 10:37:02 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 678dcd0931b9d98b7831f224801aaf54ff9596c2
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Jul 27 17:59:38 2021 +0300
response: use auto flag for chunked encoding header
---
src/microhttpd/response.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index f502187f..6e6ed4d3 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -468,9 +468,23 @@ MHD_add_response_header (struct MHD_Response *response,
"chunked" is not allowed. Note that MHD will set the
correct transfer encoding if required automatically. */
/* NOTE: for compressed bodies, use the "Content-encoding" header */
- if ( (! MHD_str_equal_caseless_ (content, "identity")) &&
- (! MHD_str_equal_caseless_ (content, "chunked")) )
- return MHD_NO;
+ if (MHD_str_equal_caseless_ (content, "identity"))
+ return add_response_entry (response,
+ MHD_HEADER_KIND,
+ header,
+ content);
+ else if (MHD_str_equal_caseless_ (content, "chunked"))
+ {
+ if (MHD_NO != add_response_entry (response,
+ MHD_HEADER_KIND,
+ header,
+ content))
+ {
+ response->flags_auto |= MHD_RAF_HAS_TRANS_ENC_CHUNKED;
+ return MHD_YES;
+ }
+ }
+ return MHD_NO;
}
if ( (0 == (MHD_RF_INSANITY_HEADER_CONTENT_LENGTH
& response->flags)) &&
@@ -555,6 +569,12 @@ MHD_del_response_header (struct MHD_Response *response,
free (pos->header);
free (pos->value);
free (pos);
+ if ( (MHD_STATICSTR_LEN_ (MHD_HTTP_HEADER_TRANSFER_ENCODING) ==
+ header_len) &&
+ MHD_str_equal_caseless_bin_n_ (header,
+ MHD_HTTP_HEADER_TRANSFER_ENCODING,
+ header_len) )
+ response->flags_auto &= ~(MHD_RAF_HAS_TRANS_ENC_CHUNKED);
return MHD_YES;
}
pos = pos->next;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (237aebfa -> 182ed3a0), gnunet, 2021/07/28
- [libmicrohttpd] 02/07: try_ready_chunked_body: use new string function, fixes., gnunet, 2021/07/28
- [libmicrohttpd] 03/07: response: use auto flag for chunked encoding header,
gnunet <=
- [libmicrohttpd] 07/07: response: use macro instead of string for connection header, gnunet, 2021/07/28
- [libmicrohttpd] 05/07: Re-written chunk footer generation function as a separate function, gnunet, 2021/07/28
- [libmicrohttpd] 01/07: Added internal functions for printing decimal and hex numbers, gnunet, 2021/07/28
- [libmicrohttpd] 04/07: keepalive_possible(): check whether app requested close, gnunet, 2021/07/28
- [libmicrohttpd] 06/07: Added new public API function MHD_get_reason_phrase_len_for(), gnunet, 2021/07/28