aboutsummaryrefslogtreecommitdiff
path: root/src/http.lua
diff options
context:
space:
mode:
authorCaleb Maclennan <caleb@alerque.com>2026-08-31 11:08:19 +0300
committerGitHub <noreply@github.com>2026-08-31 11:08:19 +0300
commit8e00f02f24d8618fcbff42c93a7ee512f694cc2f (patch)
treeafb9d251d53bf2bdba571b91d9609efa477fbf72 /src/http.lua
parent01162f05408ac4206be15842ef91048c63c23869 (diff)
parent630a3b7f4fb0c786170e3903175e964bbc1bc77f (diff)
downloadluasocket-8e00f02f24d8618fcbff42c93a7ee512f694cc2f.tar.gz
luasocket-8e00f02f24d8618fcbff42c93a7ee512f694cc2f.tar.bz2
luasocket-8e00f02f24d8618fcbff42c93a7ee512f694cc2f.zip
Merge pull request #472 from lunarmodules/feat/url-hosttype
feat(url): classify host as name/ipv4/ipv6 in parse and build
Diffstat (limited to 'src/http.lua')
-rw-r--r--src/http.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/http.lua b/src/http.lua
index f031c1d..263e621 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -244,7 +244,8 @@ end
244 244
245local function adjustheaders(reqt) 245local function adjustheaders(reqt)
246 -- default headers 246 -- default headers
247 local host = reqt.host 247 local hosttype, host = url.classify_host(reqt.host)
248 if hosttype == "ipv6" then host = "[" .. host .. "]" end
248 local port = tostring(reqt.port) 249 local port = tostring(reqt.port)
249 if port ~= tostring(SCHEMES[reqt.scheme].port) then 250 if port ~= tostring(SCHEMES[reqt.scheme].port) then
250 host = host .. ':' .. port end 251 host = host .. ':' .. port end