      r->headers_out.etag = etag;
  
 -- 
-2.18.0
+2.19.0
 

+
+        *ptr2++ = '"';
+        *ptr2 = '\0';
 
-    etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"",
-                                  r->headers_out.last_modified_time,
-                                  r->headers_out.content_length_n)
-                      - etag->value.data;
+        etag->value.len = ngx_strlen(ptr1);
+        etag->value.data = ngx_pnalloc(r->pool, etag->value.len);
+

 
     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)
     etag->hash = 1;
     ngx_str_set(&etag->key, "ETag");
 
-    etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
-    if (etag->value.data == NULL) {
+    real = ngx_realpath(clcf->root.data, NULL);
+
+    if (real == NULL) {
         etag->hash = 0;
         return NGX_ERROR;
     }
 
-    etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"",
-                                  r->headers_out.last_modified_time,
-                                  r->headers_out.content_length_n)
-                      - etag->value.data;
+    #define NIX_STORE_DIR "/nix/store"
+    #define NIX_STORE_LEN ngx_strlen(NIX_STORE_DIR)
+
