mod_http_files: send valid ETag header
authorAnton Shestakov <av6@dwimlabs.net>
Sat, 9 Jul 2016 13:55:37 +0000 (21:55 +0800)
committerAnton Shestakov <av6@dwimlabs.net>
Sat, 9 Jul 2016 13:55:37 +0000 (21:55 +0800)
RFC 2616 section 14 (header field definitions) shows that ETag header content
should be wrapped in double quotes.

plugins/mod_http_files.lua

index 3b60249559c6e7e42bee94699d0f14ba122f7c4b..40f46c9cf8b9dc524f6c643731b1e2c5e9cf8a60 100644 (file)
@@ -109,7 +109,7 @@ function serve(opts)
                local last_modified = os_date('!%a, %d %b %Y %H:%M:%S GMT', attr.modification);
                response_headers.last_modified = last_modified;
 
-               local etag = ("%02x-%x-%x-%x"):format(attr.dev or 0, attr.ino or 0, attr.size or 0, attr.modification or 0);
+               local etag = ('"%02x-%x-%x-%x"'):format(attr.dev or 0, attr.ino or 0, attr.size or 0, attr.modification or 0);
                response_headers.etag = etag;
 
                local if_none_match = request_headers.if_none_match