Add strftime to modified-date-check

This commit is contained in:
FRIGN 2014-08-11 13:12:53 +02:00
parent 5c7155255c
commit b00fc1454f

View file

@ -183,7 +183,7 @@ void
responsefile(void) { responsefile(void) {
const char *mimetype = "application/octet-stream"; const char *mimetype = "application/octet-stream";
char *p; char *p;
char mod[25]; char mod[30];
int i, ffd, r; int i, ffd, r;
struct stat st; struct stat st;
time_t t; time_t t;
@ -199,8 +199,7 @@ responsefile(void) {
} else { } else {
/* check if modified */ /* check if modified */
t = st.st_mtim.tv_sec; t = st.st_mtim.tv_sec;
memcpy(mod, asctime(gmtime(&t)), 24); strftime(mod, sizeof mod, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&t));
mod[24] = 0;
if (!strcmp(reqmod, mod) && !putresentry(HEADER, HttpNotModified, tstamp())) { if (!strcmp(reqmod, mod) && !putresentry(HEADER, HttpNotModified, tstamp())) {
/* not modified, we're done here*/ /* not modified, we're done here*/
status = 304; status = 304;