aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-12-17 20:37:58 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-12-17 20:37:58 +0100
commit70683faf380681a11e16a85090162581aed55d73 (patch)
tree3909adcc9021011486fe55c41a8158ce616ea27b
parentcb91a818c8f7730d8f3b30b5b4e75fd21496609f (diff)
downloadbusybox-w32-70683faf380681a11e16a85090162581aed55d73.tar.gz
busybox-w32-70683faf380681a11e16a85090162581aed55d73.tar.bz2
busybox-w32-70683faf380681a11e16a85090162581aed55d73.zip
httpd: don't send Content-Length in error pages header
function old new delta send_headers 701 713 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/httpd.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 31c8489d3..4def1b6fc 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1125,7 +1125,7 @@ static void send_headers(unsigned responseNum)
1125 "Connection: close\r\n", 1125 "Connection: close\r\n",
1126 responseNum, responseString 1126 responseNum, responseString
1127#if ENABLE_FEATURE_HTTPD_DATE 1127#if ENABLE_FEATURE_HTTPD_DATE
1128 ,date_str 1128 , date_str
1129#endif 1129#endif
1130 ); 1130 );
1131 } 1131 }
@@ -1222,17 +1222,29 @@ static void send_headers(unsigned responseNum)
1222// (NB: standards do not define "Transfer-Length:" _header_, 1222// (NB: standards do not define "Transfer-Length:" _header_,
1223// transfer-length above is just a concept). 1223// transfer-length above is just a concept).
1224 1224
1225#if ENABLE_FEATURE_HTTPD_RANGES \
1226 || ENABLE_FEATURE_HTTPD_LAST_MODIFIED \
1227 || ENABLE_FEATURE_HTTPD_ETAG
1225 len += sprintf(iobuf + len, 1228 len += sprintf(iobuf + len,
1226#if ENABLE_FEATURE_HTTPD_RANGES 1229# if ENABLE_FEATURE_HTTPD_RANGES
1227 "Accept-Ranges: bytes\r\n" 1230 "Accept-Ranges: bytes\r\n"
1228#endif 1231# endif
1229#if ENABLE_FEATURE_HTTPD_LAST_MODIFIED 1232# if ENABLE_FEATURE_HTTPD_LAST_MODIFIED
1230 "Last-Modified: %s\r\n" 1233 "Last-Modified: %s\r\n"
1231#endif 1234# endif
1232#if ENABLE_FEATURE_HTTPD_ETAG 1235# if ENABLE_FEATURE_HTTPD_ETAG
1233 "ETag: %s\r\n" 1236 "ETag: %s\r\n"
1237# endif
1238# if ENABLE_FEATURE_HTTPD_LAST_MODIFIED
1239 , date_str
1240# endif
1241# if ENABLE_FEATURE_HTTPD_ETAG
1242 , G.etag
1243# endif
1234#endif 1244#endif
1235 1245 );
1246 if (!infoString) {
1247 len += sprintf(iobuf + len,
1236 /* Because of 4.4 (5), we can forgo sending of "Content-Length" 1248 /* Because of 4.4 (5), we can forgo sending of "Content-Length"
1237 * since we close connection afterwards, but it helps clients 1249 * since we close connection afterwards, but it helps clients
1238 * to e.g. estimate download times, show progress bars etc. 1250 * to e.g. estimate download times, show progress bars etc.
@@ -1240,14 +1252,9 @@ static void send_headers(unsigned responseNum)
1240 * but de-facto standard is to send it (see comment below). 1252 * but de-facto standard is to send it (see comment below).
1241 */ 1253 */
1242 "Content-Length: %"OFF_FMT"u\r\n", 1254 "Content-Length: %"OFF_FMT"u\r\n",
1243#if ENABLE_FEATURE_HTTPD_LAST_MODIFIED
1244 date_str,
1245#endif
1246#if ENABLE_FEATURE_HTTPD_ETAG
1247 G.etag,
1248#endif
1249 file_size 1255 file_size
1250 ); 1256 );
1257 }
1251 } 1258 }
1252 1259
1253 /* This should be "Transfer-Encoding", not "Content-Encoding": 1260 /* This should be "Transfer-Encoding", not "Content-Encoding":