gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated (f2565a62 -> c3563144)


From: gnunet
Subject: [libmicrohttpd] branch master updated (f2565a62 -> c3563144)
Date: Mon, 14 Mar 2022 19:23:21 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from f2565a62 MHD_set_response_options(): check whether the new flags could 
be used
     new 470e65c6 Disallowed MHD_SIZE_UNKNOWN for buffer-based responses
     new c3563144 MHD_queue_response(): significantly improved doxy

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/microhttpd.h    | 22 ++++++++++++++++++----
 src/microhttpd/connection.c | 22 ++++++++++++++++++----
 src/microhttpd/response.c   |  2 ++
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index d26702da..e49afdad 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -3224,10 +3224,24 @@ MHD_lookup_connection_value_n (struct MHD_Connection 
*connection,
  * For suspended connection this function can be called at any moment. Response
  * will be sent as soon as connection is resumed.
  *
- * If response object is used to answer HEAD request then the body of
- * the response is not used, while all headers (including automatic headers)
- * are used. In practice, the same response object can be used to respond to
- * both HEAD and GET requests.
+ * If HTTP specifications require use no body in reply, like @a status_code 
with
+ * value 1xx, the response body is automatically not sent even if it is present
+ * in the response. No "Content-Length" or "Transfer-Encoding" headers are
+ * generated and added.
+ *
+ * When the response is used to respond HEAD request or used with @a 
status_code
+ * #MHD_HTTP_NOT_MODIFIED, then response body is not sent, but "Content-Length"
+ * header is added automatically based the size of the body in the response.
+ * If body size it set to #MHD_SIZE_UNKNOWN or chunked encoding is enforced
+ * then "Transfer-Encoding: chunked" header (for HTTP/1.1 only) is added 
instead
+ * of "Content-Length" header.
+ *
+ * In situations, where reply body is required, like answer for the GET request
+ * with @a status_code #MHD_HTTP_OK, headers "Content-Length" (for known body
+ * size) or "Transfer-Encoding: chunked" (for #MHD_SIZE_UNKNOWN with HTTP/1.1)
+ * are added automatically.
+ * In practice, the same response object can be used to respond to both HEAD 
and
+ * GET requests.
  *
  * @param connection the connection identifying the client
  * @param status_code HTTP status code (i.e. #MHD_HTTP_OK)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index af2036a0..759ca54b 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -5136,10 +5136,24 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
  * For suspended connection this function can be called at any moment. Response
  * will be sent as soon as connection is resumed.
  *
- * If response object is used to answer HEAD request then the body of
- * the response is not used, while all headers (including automatic headers)
- * are used. In practice, the same response object can be used to respond to
- * both HEAD and GET requests.
+ * If HTTP specifications require use no body in reply, like @a status_code 
with
+ * value 1xx, the response body is automatically not sent even if it is present
+ * in the response. No "Content-Length" or "Transfer-Encoding" headers are
+ * generated and added.
+ *
+ * When the response is used to respond HEAD request or used with @a 
status_code
+ * #MHD_HTTP_NOT_MODIFIED, then response body is not sent, but "Content-Length"
+ * header is added automatically based the size of the body in the response.
+ * If body size it set to #MHD_SIZE_UNKNOWN or chunked encoding is enforced
+ * then "Transfer-Encoding: chunked" header (for HTTP/1.1 only) is added 
instead
+ * of "Content-Length" header.
+ *
+ * In situations, where reply body is required, like answer for the GET request
+ * with @a status_code #MHD_HTTP_OK, headers "Content-Length" (for known body
+ * size) or "Transfer-Encoding: chunked" (for #MHD_SIZE_UNKNOWN with HTTP/1.1)
+ * are added automatically.
+ * In practice, the same response object can be used to respond to both HEAD 
and
+ * GET requests.
  *
  * @param connection the connection identifying the client
  * @param status_code HTTP status code (i.e. #MHD_HTTP_OK)
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index fbee6308..7468a232 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -1279,6 +1279,8 @@ MHD_create_response_from_data (size_t size,
 
   if ((NULL == data) && (size > 0))
     return NULL;
+  if (MHD_SIZE_UNKNOWN == size)
+    return NULL;
   if (NULL == (response = MHD_calloc_ (1, sizeof (struct MHD_Response))))
     return NULL;
   response->fd = -1;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]