[PATCH] Upstream: Last-Modified and Accept-Ranges should be removable.
Maxim Dounin
mdounin at mdounin.ru
Tue May 26 20:23:56 MSD 2009
Hello!
Начиная с 0.7.44 фильтры (включая ssi и gzip) не имели возможности
удалить заголовки Last-Modified и Accept-Ranges из ответа,
полученного от upstream'а, и оные заголовки возвращались клиенту.
Прилагающийся патч устраняет проблему.
Maxim Dounin
-------------- next part --------------
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1243354399 -14400
# Node ID d53191f7bfea43fbee25ce4d98b711d3542cf1cc
# Parent 6d9fb4461113f8e861a39200c87699c3405060d4
Upstream: Last-Modified and Accept-Ranges should be removable.
Since introduction of cache in 0.7.44 it wasn't possible to clear
Accept-Ranges and Last-Modified headers got from upstream. As a result
replies processed by various filters (including ssi and gzip) were send
to clients with incorrect headers.
While here fix ssi filter to actually clear Accept-Ranges header. It wasn't
done correctly for proxied replies even before 0.7.44 - probably assuming
that clearing Content-Length is enough (it's enough for local replies, but
not for proxied).
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -360,6 +360,7 @@ ngx_http_ssi_header_filter(ngx_http_requ
if (r == r->main) {
ngx_http_clear_content_length(r);
ngx_http_clear_last_modified(r);
+ ngx_http_clear_accept_ranges(r);
}
return ngx_http_next_header_filter(r);
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -3251,10 +3251,11 @@ ngx_http_upstream_copy_last_modified(ngx
*ho = *h;
+ r->headers_out.last_modified = ho;
+
#if (NGX_HTTP_CACHE)
if (r->cached || r->upstream->cacheable) {
- r->headers_out.last_modified = ho;
r->headers_out.last_modified_time = ngx_http_parse_time(h->value.data,
h->value.len);
}
@@ -3378,6 +3379,8 @@ ngx_http_upstream_copy_allow_ranges(ngx_
*ho = *h;
+ r->headers_out.accept_ranges = ho;
+
return NGX_OK;
}
More information about the nginx-ru
mailing list