quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit b00fc1454fb34223ee7273d2ec9152082d0b4736
parent 5c7155255cf5c1d248919acfac9834aba743848b
Author: FRIGN <dev@frign.de>
Date:   Mon, 11 Aug 2014 13:12:53 +0200

Add strftime to modified-date-check

Diffstat:
Mquark.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 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;