diff options
| author | Caleb Maclennan <caleb@alerque.com> | 2026-08-31 11:08:19 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-31 11:08:19 +0300 |
| commit | 8e00f02f24d8618fcbff42c93a7ee512f694cc2f (patch) | |
| tree | afb9d251d53bf2bdba571b91d9609efa477fbf72 /src/http.lua | |
| parent | 01162f05408ac4206be15842ef91048c63c23869 (diff) | |
| parent | 630a3b7f4fb0c786170e3903175e964bbc1bc77f (diff) | |
| download | luasocket-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.lua | 3 |
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 | ||
| 245 | local function adjustheaders(reqt) | 245 | local 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 |
