[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/02: RFC compliance: HTTP/1.1 replies for HTTP/1.0 cli
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/02: RFC compliance: HTTP/1.1 replies for HTTP/1.0 clients |
Date: |
Thu, 19 Aug 2021 15:07:26 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit f5fc702a4d2ddf67eb1eb7dd29a0924a2aab2096
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Aug 19 14:32:15 2021 +0300
RFC compliance: HTTP/1.1 replies for HTTP/1.0 clients
---
src/include/microhttpd.h | 2 +-
src/microhttpd/connection.c | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index d2b63947..e1bf8dd1 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -131,7 +131,7 @@ typedef intptr_t ssize_t;
* they are parsed as decimal numbers.
* Example: 0x01093001 = 1.9.30-1.
*/
-#define MHD_VERSION 0x00097306
+#define MHD_VERSION 0x00097307
#ifdef __has_attribute
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index bc13ea07..0f05f849 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1868,20 +1868,25 @@ build_header_response (struct MHD_Connection
*connection)
/* The HTTP version */
if (0 == (c->responseCode & MHD_ICY_FLAG))
- {
- if ((0 != (r->flags & MHD_RF_HTTP_VERSION_1_0_RESPONSE)) ||
- (MHD_HTTP_VER_1_0 == c->http_ver) )
- {
- /* TODO: use HTTP/1.1 responses for HTTP/1.0 clients.
+ { /* HTTP reply */
+ if (0 != (r->flags & MHD_RF_HTTP_VERSION_1_0_RESPONSE))
+ { /* HTTP/1.1 reply */
+ /* Use HTTP/1.1 responses for HTTP/1.0 clients.
* See https://datatracker.ietf.org/doc/html/rfc7230#section-2.6 */
if (! buffer_append_s (buf, &pos, buf_size, MHD_HTTP_VERSION_1_0))
return MHD_NO;
}
- else if (! buffer_append_s (buf, &pos, buf_size, MHD_HTTP_VERSION_1_1))
+ else
+ { /* HTTP/1.0 reply */
+ if (! buffer_append_s (buf, &pos, buf_size, MHD_HTTP_VERSION_1_1))
+ return MHD_NO;
+ }
+ }
+ else
+ { /* ICY reply */
+ if (! buffer_append_s (buf, &pos, buf_size, "ICY"))
return MHD_NO;
}
- else if (! buffer_append_s (buf, &pos, buf_size, "ICY"))
- return MHD_NO;
/* The response code */
if (buf_size < pos + 5) /* space + code + space */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.