lua-users home
lua-l archive

Re: Question about LuaSocket : Always receive Http Error:Number 302

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On May 26, 2010, at 5:13 PM, 木村 圭佑 wrote:
> 	 redirect = true
> 	}
http.lua should handle redirect automatically if instructed to do so, as you have.
In http.lua:
local function shouldredirect(reqt, code, headers)
 return headers.location and
 string.gsub(headers.location, "%s", "") ~= "" and
 (reqt.redirect ~= false) and
 (code == 301 or code == 302 or code == 303 or code == 307) and
 (not reqt.method or reqt.method == "GET" or reqt.method == "HEAD")
 and (not reqt.nredirects or reqt.nredirects < 5)
end

AltStyle によって変換されたページ (->オリジナル) /