aboutsummaryrefslogtreecommitdiff
path: root/picohttp.c
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de>2013-06-18 20:21:17 +0200
committerWolfgang Draxinger <Wolfgang.Draxinger@physik.uni-muenchen.de>2013-06-18 20:21:17 +0200
commit3293d9eeed04c67669c06bc745ea9ee05012cb7f (patch)
tree7ce85af8f494668992c3ec540ebbde2aed4869e0 /picohttp.c
parent03292a30587f7795a88b8014fba33810c182c009 (diff)
parent3fe9937a5505528b0a2ac17875b9117c8c17c3ff (diff)
downloadlitheweb-3293d9eeed04c67669c06bc745ea9ee05012cb7f.tar.gz
litheweb-3293d9eeed04c67669c06bc745ea9ee05012cb7f.tar.bz2
Merge branch 'master' of mhzoctdev.maiman:/srv/git/mhzoct/picoweb
Diffstat (limited to 'picohttp.c')
-rw-r--r--picohttp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/picohttp.c b/picohttp.c
index 6576297..487a870 100644
--- a/picohttp.c
+++ b/picohttp.c
@@ -37,6 +37,9 @@ static char const PICOHTTP_STR_FORMDATA[] = "form-data";
static char const PICOHTTP_STR_CACHECONTROL[] = "Cache-Control";
+static char const PICOHTTP_STR_CONNECTION[] = "Connection";
+static char const PICOHTTP_STR_CLOSE[] = "close";
+
static char const PICOHTTP_STR_DATE[] = "Date";
static char const PICOHTTP_STR_EXPECT[] = "Expect";
@@ -73,6 +76,7 @@ static size_t picohttp_fmt_int(char *dest,int i) {
return picohttp_fmt_uint(dest, i);
}
#else
+#include <djb/byte/fmt.h>
#define picohttp_fmt_uint fmt_ulong
#define picohttp_fmt_int fmt_long
#endif
@@ -783,6 +787,13 @@ int picohttpResponseSendHeaders (
0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CRLF)) )
return e;
+ /* Connection header -- for now this is "Connection: close" */
+ if( 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CONNECTION)) ||
+ 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CLSP)) ||
+ 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CLOSE)) ||
+ 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CRLF)) )
+ return e;
+
/* Content-Type header */
if( 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CONTENT)) ||
0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR__TYPE)) ||
@@ -793,6 +804,7 @@ int picohttpResponseSendHeaders (
0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CRLF)) )
return e;
+ /* Content-Length header */
if( req->response.contentlength ){
p = picohttp_fmt_uint(tmp, req->response.contentlength);
if( 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CONTENT)) ||