[mod_expire] reset caching response headers for error docs (fixes #1919)
remove Cache-Control and Expires headers before handling error docs (caching headers may have been set by mod_expire before http status was determined to be an error) x-ref: "mod_expires sends headers on 404 responses" https://redmine.lighttpd.net/issues/1919
This commit is contained in:
parent
f4cb07f723
commit
760baed402
1
NEWS
1
NEWS
|
@ -68,6 +68,7 @@ NEWS
|
|||
* [mod_magnet] rename var for clarity (fixes #1483)
|
||||
* [mod_extforward] reset cond_cache for scheme (fixes #1499)
|
||||
* [mod_webdav] readdir POSIX compat (fixes #1826)
|
||||
* [mod_expire] reset caching response headers for error docs (fixes #1919)
|
||||
|
||||
- 1.4.39 - 2016-01-02
|
||||
* [core] fix memset_s call (fixes #2698)
|
||||
|
|
|
@ -415,6 +415,17 @@ static int connection_handle_read(server *srv, connection *con) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void connection_handle_errdoc_init(connection *con) {
|
||||
/* reset caching response headers potentially added by mod_expire */
|
||||
data_string *ds;
|
||||
if (NULL != (ds = (data_string*) array_get_element(con->response.headers, "Expires"))) {
|
||||
buffer_reset(ds->value); /* Headers with empty values are ignored for output */
|
||||
}
|
||||
if (NULL != (ds = (data_string*) array_get_element(con->response.headers, "Cache-Control"))) {
|
||||
buffer_reset(ds->value); /* Headers with empty values are ignored for output */
|
||||
}
|
||||
}
|
||||
|
||||
static int connection_handle_write_prepare(server *srv, connection *con) {
|
||||
if (con->mode == DIRECT) {
|
||||
/* static files */
|
||||
|
@ -474,6 +485,7 @@ static int connection_handle_write_prepare(server *srv, connection *con) {
|
|||
con->file_finished = 0;
|
||||
|
||||
buffer_reset(con->physical.path);
|
||||
connection_handle_errdoc_init(con);
|
||||
|
||||
/* try to send static errorfile */
|
||||
if (!buffer_string_is_empty(con->conf.errorfile_prefix)) {
|
||||
|
@ -1309,6 +1321,7 @@ int connection_state_machine(server *srv, connection *con) {
|
|||
buffer_copy_buffer(con->request.uri, con->error_handler);
|
||||
}
|
||||
buffer_reset(con->physical.path);
|
||||
connection_handle_errdoc_init(con);
|
||||
|
||||
con->in_error_handler = 1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue