Changes between Initial Version and Version 2 of Ticket #1357


Ignore:
Timestamp:
08/15/17 16:08:40 (7 years ago)
Author:
Maxim Dounin
Comment:

Please try the following patch:

# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1502813238 -10800
#      Tue Aug 15 19:07:18 2017 +0300
# Node ID d51ee844db963d4c51ea1d9eed335af19c95f43a
# Parent  a2f5e25d6a283546f76435b9fc3e7e814b092bae
Upstream: unconditional parsing of last_modified_time.

This fixes at least the following cases, where no last_modified_time
(assuming caching is not enabled) resulted in incorrect behaviour:

- slice filter and If-Range requests (ticket #1357);
- If-Range requests with proxy_force_ranges;
- expires modified.

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
@@ -4390,15 +4390,8 @@ ngx_http_upstream_process_last_modified(
     u = r->upstream;
 
     u->headers_in.last_modified = h;
-
-#if (NGX_HTTP_CACHE)
-
-    if (u->cacheable) {
-        u->headers_in.last_modified_time = ngx_parse_http_time(h->value.data,
-                                                               h->value.len);
-    }
-
-#endif
+    u->headers_in.last_modified_time = ngx_parse_http_time(h->value.data,
+                                                           h->value.len);
 
     return NGX_OK;
 }
@@ -4940,15 +4933,8 @@ ngx_http_upstream_copy_last_modified(ngx
     *ho = *h;
 
     r->headers_out.last_modified = ho;
-
-#if (NGX_HTTP_CACHE)
-
-    if (r->upstream->cacheable) {
-        r->headers_out.last_modified_time =
+    r->headers_out.last_modified_time =
                                     r->upstream->headers_in.last_modified_time;
-    }
-
-#endif
 
     return NGX_OK;
 }

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1357 – Description

    initial v2  
     1{{{
    12server {
    23    listen 8888;
     
    2627    }
    2728}
     29}}}
    2830
    29 
    30 
     31{{{
    3132#curl http://127.0.0.1:8001/4K.mp4 -o /dev/null -v -H 'range: bytes=1-2' -H 'if-range: Wed, 09 Aug 2017 08:29:34 GMT'
    3233* About to connect() to 127.0.0.1 port 8001 (#0)
     
    5556100     2  100     2    0     0   1010      0 --:--:-- --:--:-- --:--:--  2000
    5657* Connection #0 to host 127.0.0.1 left intact
     58}}}
    5759
    5860return 206, meet expectation
     
    6163[[BR]]
    6264
    63 
    64 
     65{{{
    6566#curl http://127.0.0.1:8000/4K.mp4 -o /dev/null -v -H 'range: bytes=1-2' -H 'if-range: Wed, 09 Aug 2017 08:29:34 GMT'
    6667* About to connect() to 127.0.0.1 port 8000 (#0)
     
    8990100  4096  100  4096    0     0  1036k      0 --:--:-- --:--:-- --:--:-- 1333k
    9091* Connection #0 to host 127.0.0.1 left intact
     92}}}
    9193
    9294return 200, not meet expectation