[hackers] [quark] Add strftime to modified-date-check || FRIGN

From: <git_AT_suckless.org>
Date: Mon, 11 Aug 2014 13:11:46 +0200

commit b00fc1454fb34223ee7273d2ec9152082d0b4736
Author: FRIGN <dev_AT_frign.de>
Date: Mon Aug 11 13:12:53 2014 +0200

    Add strftime to modified-date-check

diff --git a/quark.c b/quark.c
index b6e7578..0c53439 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -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;
_AT_@ -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;
Received on Mon Aug 11 2014 - 13:11:46 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 11 2014 - 13:12:08 CEST