From d9ca8bd72350526bf92334c77ea90a8475f36014 Mon Sep 17 00:00:00 2001 From: thlo Date: Wed, 1 May 2013 17:55:14 +0200 Subject: cleanups --- responsebase.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'responsebase.c') diff --git a/responsebase.c b/responsebase.c index 77bca0a..633b922 100644 --- a/responsebase.c +++ b/responsebase.c @@ -75,6 +75,7 @@ void cResponseBase::sendError(int status, const char *title, const char *extra, void cResponseBase::sendHeaders(int status, const char *title, const char *extra, const char *mime, long long int length, time_t date) { + time_t now; char timebuf[128]; char f[400]; @@ -97,10 +98,12 @@ void cResponseBase::sendHeaders(int status, const char *title, const char *extra snprintf(f, sizeof(f), "Content-Type: %s\r\n", mime); hdr += f; } + if (length >= 0) { snprintf(f, sizeof(f), "Content-Length: %lld\r\n", length); hdr += f; } + if (date != -1) { strftime(timebuf, sizeof(timebuf), RFC1123FMT, gmtime(&date)); snprintf(f, sizeof(f), "Last-Modified: %s\r\n", timebuf); -- cgit v1.2.3