Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion http.lua
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,12 @@ function M.send(method, t)

if not t.headers.host then
-- 'Host' header must be provided for HTTP/1.1
table.insert(hdr_tbl, "host: " .. host)
if addr:find(":") and not addr:match("^%[.*%]$") then
-- Enclose IPv6 addresses in square brackets
table.insert(hdr_tbl, string.format("host: [%s]:%s", addr, port))
else
table.insert(hdr_tbl, "host: " .. host)
end
end

if not t.headers["accept"] then
Expand Down