luci-0.9: merge r5635
This commit is contained in:
parent
723c9a900b
commit
82cc8fddef
1 changed files with 4 additions and 5 deletions
|
@ -93,16 +93,15 @@ end
|
||||||
-- @return Alternative status code if the precondition failed
|
-- @return Alternative status code if the precondition failed
|
||||||
-- @return Table containing extra HTTP headers if the precondition failed
|
-- @return Table containing extra HTTP headers if the precondition failed
|
||||||
function if_none_match( req, stat )
|
function if_none_match( req, stat )
|
||||||
local h = req.headers
|
local h = req.headers
|
||||||
local etag = mk_etag( stat )
|
local etag = mk_etag( stat )
|
||||||
|
local method = req.env and req.env.REQUEST_METHOD or "GET"
|
||||||
|
|
||||||
-- Check for matching resource
|
-- Check for matching resource
|
||||||
if type(h['If-None-Match']) == "string" then
|
if type(h['If-None-Match']) == "string" then
|
||||||
for ent in h['If-None-Match']:gmatch("([^, ]+)") do
|
for ent in h['If-None-Match']:gmatch("([^, ]+)") do
|
||||||
if ( ent == '*' or ent == etag ) and stat ~= nil then
|
if ( ent == '*' or ent == etag ) and stat ~= nil then
|
||||||
if req.request_method == "get" or
|
if method == "GET" or method == "HEAD" then
|
||||||
req.request_method == "head"
|
|
||||||
then
|
|
||||||
return false, 304, {
|
return false, 304, {
|
||||||
["ETag"] = mk_etag( stat );
|
["ETag"] = mk_etag( stat );
|
||||||
["Date"] = date.to_http( os.time() );
|
["Date"] = date.to_http( os.time() );
|
||||||
|
|
Loading…
Reference in a new issue