aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--picohttp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/picohttp.c b/picohttp.c
index 7e56de1..43d4652 100644
--- a/picohttp.c
+++ b/picohttp.c
@@ -19,6 +19,9 @@ static char const PICOHTTP_STR__CODING[] = "-Coding";
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";
@@ -651,6 +654,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)) ||
@@ -661,6 +671,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)) ||