diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-12-20 18:18:43 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-12-20 18:18:43 +0000 |
commit | 21328113ddcd07a1711ce0a14c6c4abe6d1de503 (patch) | |
tree | 64250b300247a12a4ad692fdfce227fb0a37f10f /libs | |
parent | 9fbd8df110874ad6324e9be5862e8558a30880bc (diff) |
libs/http: fix incorrent treatment of If-None-Match (#100)
Diffstat (limited to 'libs')
-rw-r--r-- | libs/http/luasrc/http/protocol/conditionals.lua | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libs/http/luasrc/http/protocol/conditionals.lua b/libs/http/luasrc/http/protocol/conditionals.lua index 015cf4518..635d6b2db 100644 --- a/libs/http/luasrc/http/protocol/conditionals.lua +++ b/libs/http/luasrc/http/protocol/conditionals.lua @@ -93,16 +93,15 @@ end -- @return Alternative status code if the precondition failed -- @return Table containing extra HTTP headers if the precondition failed function if_none_match( req, stat ) - local h = req.headers - local etag = mk_etag( stat ) + local h = req.headers + local etag = mk_etag( stat ) + local method = req.env and req.env.REQUEST_METHOD or "GET" -- Check for matching resource if type(h['If-None-Match']) == "string" then for ent in h['If-None-Match']:gmatch("([^, ]+)") do if ( ent == '*' or ent == etag ) and stat ~= nil then - if req.request_method == "get" or - req.request_method == "head" - then + if method == "GET" or method == "HEAD" then return false, 304, { ["ETag"] = mk_etag( stat ); ["Date"] = date.to_http( os.time() ); |