diff options
Diffstat (limited to 'picohttp.c')
-rw-r--r-- | picohttp.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -1039,15 +1039,17 @@ int picohttpResponseSendHeaders ( 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)) || - 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CLSP)) || - 0 > (e = picohttpIoWrite( - req->ioops, strlen(req->response.contenttype), - req->response.contenttype)) || - 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CRLF)) ) - return e; + if(req->response.contenttype) { + /* Content-Type header */ + if( 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CONTENT)) || + 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR__TYPE)) || + 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CLSP)) || + 0 > (e = picohttpIoWrite( + req->ioops, strlen(req->response.contenttype), + req->response.contenttype)) || + 0 > (e = picohttpIO_WRITE_STATIC_STR(PICOHTTP_STR_CRLF)) ) + return e; + } /* Content-Length header */ if( req->response.contentlength ){ |