summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luasocket/src/http.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luasocket/src/http.lua')
-rw-r--r--Build/source/texk/web2c/luatexdir/luasocket/src/http.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luasocket/src/http.lua b/Build/source/texk/web2c/luatexdir/luasocket/src/http.lua
index ad8db1ee065..4c7e7d80e30 100644
--- a/Build/source/texk/web2c/luatexdir/luasocket/src/http.lua
+++ b/Build/source/texk/web2c/luatexdir/luasocket/src/http.lua
@@ -2,7 +2,6 @@
-- HTTP/1.1 client support for the Lua language.
-- LuaSocket toolkit.
-- Author: Diego Nehab
--- RCS ID: $Id: http.lua,v 1.71 2007/10/13 23:55:20 diego Exp $
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
@@ -13,6 +12,7 @@ local url = require("socket.url")
local ltn12 = require("ltn12")
local mime = require("mime")
local string = require("string")
+local headers = require("socket.headers")
local base = _G
local table = require("table")
module("socket.http")
@@ -123,10 +123,11 @@ function metat.__index:sendrequestline(method, uri)
return self.try(self.c:send(reqline))
end
-function metat.__index:sendheaders(headers)
+function metat.__index:sendheaders(tosend)
+ local canonic = headers.canonic
local h = "\r\n"
- for i, v in base.pairs(headers) do
- h = i .. ": " .. v .. "\r\n" .. h
+ for f, v in base.pairs(tosend) do
+ h = (canonic[f] or f) .. ": " .. v .. "\r\n" .. h
end
self.try(self.c:send(h))
return 1
@@ -254,7 +255,7 @@ 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) 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