summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/uhttpd
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-03-21 03:46:03 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-03-21 03:46:03 +0000
commit927d47528fbd27c1374c8e88d3efc0f1ed706bd6 (patch)
tree82b5b46f58d3bf0a3482c9ceadedd93fecaa0752 /contrib/package/uhttpd
parent23052d8f013188302dd9faee47f6911e4ed0e1e1 (diff)
uhttpd: add "Connection: close" headers, mandatory according to HTTP/1.1 spec
Diffstat (limited to 'contrib/package/uhttpd')
-rw-r--r--contrib/package/uhttpd/src/uhttpd-cgi.c3
-rw-r--r--contrib/package/uhttpd/src/uhttpd-file.c7
-rw-r--r--contrib/package/uhttpd/src/uhttpd-utils.c1
3 files changed, 8 insertions, 3 deletions
diff --git a/contrib/package/uhttpd/src/uhttpd-cgi.c b/contrib/package/uhttpd/src/uhttpd-cgi.c
index 4889819aa7..5df045e8c7 100644
--- a/contrib/package/uhttpd/src/uhttpd-cgi.c
+++ b/contrib/package/uhttpd/src/uhttpd-cgi.c
@@ -430,7 +430,8 @@ void uh_cgi_request(struct client *cl, struct http_request *req, struct path_inf
{
/* write status */
ensure(uh_http_sendf(cl, NULL,
- "HTTP/%.1f %03d %s\r\n",
+ "HTTP/%.1f %03d %s\r\n"
+ "Connection: close\r\n",
req->version, res->statuscode,
res->statusmsg));
diff --git a/contrib/package/uhttpd/src/uhttpd-file.c b/contrib/package/uhttpd/src/uhttpd-file.c
index f0379bccc1..7ce5e3978a 100644
--- a/contrib/package/uhttpd/src/uhttpd-file.c
+++ b/contrib/package/uhttpd/src/uhttpd-file.c
@@ -101,6 +101,8 @@ static char * uh_file_header_lookup(struct http_request *req, const char *name)
static void uh_file_response_ok_hdrs(struct client *cl, struct http_request *req, struct stat *s)
{
+ uh_http_sendf(cl, NULL, "Connection: close\r\n");
+
if( s )
{
uh_http_sendf(cl, NULL, "ETag: %s\r\n", uh_file_mktag(s));
@@ -124,8 +126,9 @@ static void uh_file_response_304(struct client *cl, struct http_request *req, st
static void uh_file_response_412(struct client *cl, struct http_request *req)
{
- uh_http_sendf(cl, NULL, "HTTP/%.1f 412 Precondition Failed\r\n",
- req->version);
+ uh_http_sendf(cl, NULL,
+ "HTTP/%.1f 412 Precondition Failed\r\n"
+ "Connection: close\r\n", req->version);
}
static int uh_file_if_match(struct client *cl, struct http_request *req, struct stat *s)
diff --git a/contrib/package/uhttpd/src/uhttpd-utils.c b/contrib/package/uhttpd/src/uhttpd-utils.c
index 914c606116..549ad88d07 100644
--- a/contrib/package/uhttpd/src/uhttpd-utils.c
+++ b/contrib/package/uhttpd/src/uhttpd-utils.c
@@ -171,6 +171,7 @@ int uh_http_sendhf(struct client *cl, int code, const char *summary, const char
len = snprintf(buffer, sizeof(buffer),
"HTTP/1.1 %03i %s\r\n"
+ "Connection: close\r\n"
"Content-Type: text/plain\r\n"
"Transfer-Encoding: chunked\r\n\r\n",
code, summary