diff options
-rw-r--r-- | networking/httpd.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 9141442c8..a1f841aa8 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -214,6 +214,14 @@ | |||
214 | //config: help | 214 | //config: help |
215 | //config: Makes httpd send files using GZIP content encoding if the | 215 | //config: Makes httpd send files using GZIP content encoding if the |
216 | //config: client supports it and a pre-compressed <file>.gz exists. | 216 | //config: client supports it and a pre-compressed <file>.gz exists. |
217 | //config: | ||
218 | //config:config FEATURE_HTTPD_DATE | ||
219 | //config: bool "Add Date header to response" | ||
220 | //config: default y | ||
221 | //config: depends on HTTPD | ||
222 | //config: help | ||
223 | //config: RFC2616 says that server MUST add Date header to response. | ||
224 | //config: But it is almost useless and can be omitted. | ||
217 | 225 | ||
218 | //applet:IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) | 226 | //applet:IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) |
219 | 227 | ||
@@ -1071,14 +1079,20 @@ static void send_headers(unsigned responseNum) | |||
1071 | * always fit into those kbytes. | 1079 | * always fit into those kbytes. |
1072 | */ | 1080 | */ |
1073 | 1081 | ||
1082 | #if ENABLE_FEATURE_HTTPD_DATE | ||
1074 | strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime_r(&timer, &tm)); | 1083 | strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime_r(&timer, &tm)); |
1075 | /* ^^^ using gmtime_r() instead of gmtime() to not use static data */ | 1084 | /* ^^^ using gmtime_r() instead of gmtime() to not use static data */ |
1085 | #endif | ||
1076 | len = sprintf(iobuf, | 1086 | len = sprintf(iobuf, |
1077 | "HTTP/1.1 %u %s\r\n" | 1087 | "HTTP/1.1 %u %s\r\n" |
1088 | #if ENABLE_FEATURE_HTTPD_DATE | ||
1078 | "Date: %s\r\n" | 1089 | "Date: %s\r\n" |
1090 | #endif | ||
1079 | "Connection: close\r\n", | 1091 | "Connection: close\r\n", |
1080 | responseNum, responseString, | 1092 | responseNum, responseString |
1081 | date_str | 1093 | #if ENABLE_FEATURE_HTTPD_DATE |
1094 | ,date_str | ||
1095 | #endif | ||
1082 | ); | 1096 | ); |
1083 | 1097 | ||
1084 | if (responseNum != HTTP_OK || found_mime_type) { | 1098 | if (responseNum != HTTP_OK || found_mime_type) { |