From 1da8eec00fbe79301fcd5ce0b091405fc475fab0 Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Tue, 16 Oct 2018 13:24:34 +0000 Subject: [PATCH] nginx: handle impure symlinks in ETag patch --- pkgs/servers/http/nginx/nix-etag-1.15.4.patch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/servers/http/nginx/nix-etag-1.15.4.patch b/pkgs/servers/http/nginx/nix-etag-1.15.4.patch index a4ee95076c1..4d8a6510cbf 100644 --- a/pkgs/servers/http/nginx/nix-etag-1.15.4.patch +++ b/pkgs/servers/http/nginx/nix-etag-1.15.4.patch @@ -1,14 +1,14 @@ -From a0ac82e4c79f359a7001a265cdb57e35978c6c23 Mon Sep 17 00:00:00 2001 +From f6a978f024d01202f954483423af1b2d5d5159a6 Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Fri, 28 Sep 2018 03:27:04 +0000 Subject: [PATCH] If root is in Nix store, set ETag to its path hash --- - src/http/ngx_http_core_module.c | 55 +++++++++++++++++++++++++++++---- - 1 file changed, 49 insertions(+), 6 deletions(-) + src/http/ngx_http_core_module.c | 56 +++++++++++++++++++++++++++++---- + 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c -index c57ec00c..4eec7ec5 100644 +index c57ec00c..b7992de2 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1583,6 +1583,7 @@ ngx_http_set_etag(ngx_http_request_t *r) @@ -19,7 +19,7 @@ index c57ec00c..4eec7ec5 100644 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); -@@ -1598,16 +1599,58 @@ ngx_http_set_etag(ngx_http_request_t *r) +@@ -1598,16 +1599,59 @@ ngx_http_set_etag(ngx_http_request_t *r) etag->hash = 1; ngx_str_set(&etag->key, "ETag"); @@ -39,7 +39,8 @@ index c57ec00c..4eec7ec5 100644 + #define NIX_STORE_DIR "/nix/store" + #define NIX_STORE_LEN ngx_strlen(NIX_STORE_DIR) + -+ if (!ngx_strncmp(real, NIX_STORE_DIR, NIX_STORE_LEN) ++ if (r->headers_out.last_modified_time == 1 ++ && !ngx_strncmp(real, NIX_STORE_DIR, NIX_STORE_LEN) + && real[NIX_STORE_LEN] == '/' + && real[NIX_STORE_LEN + 1] != '\0') + {