X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fhttp%2Fluasrc%2Fhttp%2Fprotocol%2Fconditionals.lua;h=36f323a6e5e3dbb2013783c95885493f48302e9a;hp=0bff274cda5b3f13e2fe03fd8df0d58af64e868e;hb=e08b97565f2a2dfeb482be0f061bfefa93d32556;hpb=00aceaf624d8e5da2a8f3df161d52599aae2ac41 diff --git a/libs/http/luasrc/http/protocol/conditionals.lua b/libs/http/luasrc/http/protocol/conditionals.lua index 0bff274cd..36f323a6e 100644 --- a/libs/http/luasrc/http/protocol/conditionals.lua +++ b/libs/http/luasrc/http/protocol/conditionals.lua @@ -21,7 +21,7 @@ local date = require("luci.http.protocol.date") -- 14.19 / ETag function mk_etag( stat ) if stat ~= nil then - return string.format( "%x-%x-%x", stat.ino, stat.size, stat.mtime ) + return string.format( '"%x-%x-%x"', stat.ino, stat.size, stat.mtime ) end end @@ -56,7 +56,10 @@ function if_modified_since( req, stat ) return true end - return false, 304 + return false, 304, { + ["ETag"] = mk_etag( stat ); + ["Last-Modified"] = date.to_http( stat.mtime ) + } end return true @@ -74,10 +77,10 @@ function if_none_match( req, stat ) if req.request_method == "get" or req.request_method == "head" then - h['ETag'] = mk_etag( stat ) - h['Last-Modified'] = date.to_http( stat.mtime ) - - return false, 304 + return false, 304, { + ["ETag"] = mk_etag( stat ); + ["Last-Modified"] = date.to_http( stat.mtime ) + } else return false, 412 end