[PATCH 2/4] httpd: Don't add Date header to response

Denys Vlasenko vda.linux at googlemail.com
Sat Aug 15 21:07:03 UTC 2020


On Sun, Aug 9, 2020 at 12:24 AM Sergey Ponomarev <stokito at gmail.com> wrote:
> @@ -1071,16 +1079,18 @@ static void send_headers(unsigned responseNum)
>          * always fit into those kbytes.
>          */
>
> -       strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime_r(&timer, &tm));
> -       /* ^^^ using gmtime_r() instead of gmtime() to not use static data */
>         len = sprintf(iobuf,
>                         "HTTP/1.1 %u %s\r\n"
> -                       "Date: %s\r\n"
>                         "Connection: close\r\n",
> -                       responseNum, responseString,
> -                       date_str
> +                       responseNum, responseString
>         );
>
> +#if ENABLE_FEATURE_HTTPD_DATE
> +       strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime_r(&timer, &tm));
> +       /* ^^^ using gmtime_r() instead of gmtime() to not use static data */
> +       len += sprintf(iobuf + len, "Date: %s\r\n", date_str);
> +#endif
> +

This increases code size when FEATURE_HTTPD_DATE=y
(IOW: when functionality does not change)


More information about the busybox mailing list