]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: sample: http_date() doesn't provide the right day of the week
authorCyril Bonté <cyril.bonte@free.fr>
Fri, 22 Jan 2016 18:40:28 +0000 (19:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 22 Jan 2016 18:52:31 +0000 (19:52 +0100)
Gregor KovaÄ\8d reported that http_date() did not return the right day of the
week. For example "Sat, 22 Jan 2016 17:43:38 GMT" instead of "Fri, 22 Jan
2016 17:43:38 GMT". Indeed, gmtime() returns a 'struct tm' result, where
tm_wday begins on Sunday, whereas the code assumed it began on Monday.

This patch must be backported to haproxy 1.5 and 1.6.

src/proto_http.c

index e362a96ffbd20172e8ef541517c7af71cedb7bb7..2f76afe022b2839f5d6eabf1704bdb22ec885cef 100644 (file)
@@ -11973,7 +11973,7 @@ int val_hdr(struct arg *arg, char **err_msg)
  */
 static int sample_conv_http_date(const struct arg *args, struct sample *smp, void *private)
 {
-       const char day[7][4] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
+       const char day[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
        const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
        struct chunk *temp;
        struct tm *tm;