From b00fc1454fb34223ee7273d2ec9152082d0b4736 Mon Sep 17 00:00:00 2001 From: FRIGN Date: Mon, 11 Aug 2014 13:12:53 +0200 Subject: [PATCH] Add strftime to modified-date-check --- quark.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/quark.c b/quark.c index b6e7578..0c53439 100644 --- a/quark.c +++ b/quark.c @@ -183,7 +183,7 @@ void responsefile(void) { const char *mimetype = "application/octet-stream"; char *p; - char mod[25]; + char mod[30]; int i, ffd, r; struct stat st; time_t t; @@ -199,8 +199,7 @@ responsefile(void) { } else { /* check if modified */ t = st.st_mtim.tv_sec; - memcpy(mod, asctime(gmtime(&t)), 24); - mod[24] = 0; + strftime(mod, sizeof mod, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&t)); if (!strcmp(reqmod, mod) && !putresentry(HEADER, HttpNotModified, tstamp())) { /* not modified, we're done here*/ status = 304;