[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] Broken HTTP 1.0 and 0.9 support
From: |
Geoffrey McRae |
Subject: |
[libmicrohttpd] Broken HTTP 1.0 and 0.9 support |
Date: |
Wed, 21 Apr 2010 23:00:12 +1000 |
Hi All,
I am one of the developers for XBMC where we are using your wonderful
library for our web interface. It has come to my attention however that
support for HTTP/1.0 and 0.9 is broken/wrong.
Currently 0.9 for requests it serves out an invalid " 200 OK" and the
headers, which it should not.
For 1.0 it returns HTTP/1.1 in the response, which again is incorrect
since we made a 1.0 request.
The following patch corrects both of these issues.
Kind Regards
Geoffrey McRae (gnif)
http://www.xbmc.org/
diff --git a/lib/libmicrohttpd/src/daemon/connection.c
b/lib/libmicrohttpd/src/daemon/connection.c
index ef47b1c..dc71be9 100644
--- a/lib/libmicrohttpd/src/daemon/connection.c
+++ b/lib/libmicrohttpd/src/daemon/connection.c
@@ -577,13 +577,23 @@ build_header_response (struct MHD_Connection
*connection)
enum MHD_ValueKind kind;
const char *reason_phrase;
+ if (strlen(connection->version) == 0)
+ {
+ data = MHD_pool_allocate (connection->pool, 0, MHD_YES);
+ connection->write_buffer = data;
+ connection->write_buffer_append_offset = 0;
+ connection->write_buffer_send_offset = 0;
+ connection->write_buffer_size = 0;
+ return MHD_YES;
+ }
+
if (connection->state == MHD_CONNECTION_FOOTERS_RECEIVED)
{
add_extra_headers (connection);
reason_phrase = MHD_get_reason_phrase_for
(connection->responseCode);
SPRINTF (code,
"%s %u %s\r\n",
- MHD_HTTP_VERSION_1_1, connection->responseCode,
reason_phrase);
+ connection->version, connection->responseCode,
reason_phrase);
off = strlen (code);
/* estimate size */
size = off + 2; /* extra \r\n at the end */
- [libmicrohttpd] Broken HTTP 1.0 and 0.9 support,
Geoffrey McRae <=