httpd: do not send Last-Modified / ETag / Content-Length for error pages
function old new delta send_headers 713 701 -12 send_headers_and_exit 20 34 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
70683faf38
commit
b720629dfe
@ -1222,29 +1222,17 @@ static void send_headers(unsigned responseNum)
|
|||||||
// (NB: standards do not define "Transfer-Length:" _header_,
|
// (NB: standards do not define "Transfer-Length:" _header_,
|
||||||
// transfer-length above is just a concept).
|
// transfer-length above is just a concept).
|
||||||
|
|
||||||
#if ENABLE_FEATURE_HTTPD_RANGES \
|
|
||||||
|| ENABLE_FEATURE_HTTPD_LAST_MODIFIED \
|
|
||||||
|| ENABLE_FEATURE_HTTPD_ETAG
|
|
||||||
len += sprintf(iobuf + len,
|
len += sprintf(iobuf + len,
|
||||||
# if ENABLE_FEATURE_HTTPD_RANGES
|
#if ENABLE_FEATURE_HTTPD_RANGES
|
||||||
"Accept-Ranges: bytes\r\n"
|
"Accept-Ranges: bytes\r\n"
|
||||||
# endif
|
|
||||||
# if ENABLE_FEATURE_HTTPD_LAST_MODIFIED
|
|
||||||
"Last-Modified: %s\r\n"
|
|
||||||
# endif
|
|
||||||
# if ENABLE_FEATURE_HTTPD_ETAG
|
|
||||||
"ETag: %s\r\n"
|
|
||||||
# endif
|
|
||||||
# if ENABLE_FEATURE_HTTPD_LAST_MODIFIED
|
|
||||||
, date_str
|
|
||||||
# endif
|
|
||||||
# if ENABLE_FEATURE_HTTPD_ETAG
|
|
||||||
, G.etag
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
);
|
#if ENABLE_FEATURE_HTTPD_LAST_MODIFIED
|
||||||
if (!infoString) {
|
"Last-Modified: %s\r\n"
|
||||||
len += sprintf(iobuf + len,
|
#endif
|
||||||
|
#if ENABLE_FEATURE_HTTPD_ETAG
|
||||||
|
"ETag: %s\r\n"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Because of 4.4 (5), we can forgo sending of "Content-Length"
|
/* Because of 4.4 (5), we can forgo sending of "Content-Length"
|
||||||
* since we close connection afterwards, but it helps clients
|
* since we close connection afterwards, but it helps clients
|
||||||
* to e.g. estimate download times, show progress bars etc.
|
* to e.g. estimate download times, show progress bars etc.
|
||||||
@ -1252,10 +1240,15 @@ static void send_headers(unsigned responseNum)
|
|||||||
* but de-facto standard is to send it (see comment below).
|
* but de-facto standard is to send it (see comment below).
|
||||||
*/
|
*/
|
||||||
"Content-Length: %"OFF_FMT"u\r\n",
|
"Content-Length: %"OFF_FMT"u\r\n",
|
||||||
|
#if ENABLE_FEATURE_HTTPD_LAST_MODIFIED
|
||||||
|
date_str,
|
||||||
|
#endif
|
||||||
|
#if ENABLE_FEATURE_HTTPD_ETAG
|
||||||
|
G.etag,
|
||||||
|
#endif
|
||||||
file_size
|
file_size
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* This should be "Transfer-Encoding", not "Content-Encoding":
|
/* This should be "Transfer-Encoding", not "Content-Encoding":
|
||||||
* "data is compressed for transfer", not "data is an archive".
|
* "data is compressed for transfer", not "data is an archive".
|
||||||
@ -1297,6 +1290,7 @@ static void send_headers_and_exit(int responseNum) NORETURN;
|
|||||||
static void send_headers_and_exit(int responseNum)
|
static void send_headers_and_exit(int responseNum)
|
||||||
{
|
{
|
||||||
IF_FEATURE_HTTPD_GZIP(content_gzip = 0;)
|
IF_FEATURE_HTTPD_GZIP(content_gzip = 0;)
|
||||||
|
file_size = -1; /* no Last-Modified:, ETag:, Content-Length: */
|
||||||
send_headers(responseNum);
|
send_headers(responseNum);
|
||||||
log_and_exit();
|
log_and_exit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user