[PATCH] Handling of If-Range with add_header Last-Modified
Maxim Dounin
mdounin at mdounin.ru
Tue Sep 6 11:56:32 UTC 2011
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1315291748 -14400
# Node ID e51619385db9694030b9614c833a2b2504b377c9
# Parent 014764a85840606c90317e9f44f2b9fa139cbc8b
Handling of If-Range with add_header Last-Modified.
diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -369,7 +369,8 @@ ngx_http_set_last_modified(ngx_http_requ
old = NULL;
}
- r->headers_out.last_modified_time = -1;
+ r->headers_out.last_modified_time = ngx_http_parse_time(value->data,
+ value->len);
if (old == NULL || *old == NULL) {
@@ -382,6 +383,8 @@ ngx_http_set_last_modified(ngx_http_requ
return NGX_ERROR;
}
+ *old = h;
+
} else {
h = *old;
diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c
--- a/src/http/modules/ngx_http_range_filter_module.c
+++ b/src/http/modules/ngx_http_range_filter_module.c
@@ -173,7 +173,11 @@ ngx_http_range_header_filter(ngx_http_re
goto next_filter;
}
- if (r->headers_in.if_range && r->headers_out.last_modified_time != -1) {
+ if (r->headers_in.if_range) {
+
+ if (r->headers_out.last_modified_time == (time_t) -1) {
+ goto next_filter;
+ }
if_range = ngx_http_parse_time(r->headers_in.if_range->value.data,
r->headers_in.if_range->value.len);
More information about the nginx-devel
mailing list