diff options
Diffstat (limited to 'picohttp.c')
-rw-r--r-- | picohttp.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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)) || |