--- a/src/server/safs/service.c Sat Oct 17 21:17:34 2015 +0200 +++ b/src/server/safs/service.c Sat Oct 17 22:24:38 2015 +0200 @@ -81,14 +81,14 @@ protocol_status(sn, rq, 302, NULL); http_start_response(sn, rq); vfs_close(fd); - return fd; + return NULL; } - - // add content-length header - char contentLength[32]; - int len = snprintf(contentLength, 32, "%jd", s->st_size); - - pblock_kvinsert(pb_key_content_length, contentLength, len, rq->srvhdrs); + + // sets last-modified, content-length and checks conditions + if(http_set_finfo(sn, rq, s) != REQ_PROCEED) { + vfs_close(fd); + return NULL; + } // start response protocol_status(sn, rq, 200, NULL);