[httpc] 解决几个ipv6下面的请求规范的问题 (#2149)

* 按照RFC 3986的规范处理ipv6 host的格式化问题,ipv6地址需要用 []括起来
参考: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2

* 解决ipv6格式不对的问题

* 只有域名的情况下才 set_ext_host_name
This commit is contained in:
huojicha
2026-04-01 15:45:33 +08:00
committed by GitHub
parent 195a60d1f0
commit 58774183a7
3 changed files with 56 additions and 12 deletions

View File

@@ -7,7 +7,9 @@ function tlshelper.init_requestfunc(fd, tls_ctx)
local readfunc = socket.readfunc(fd)
local writefunc = socket.writefunc(fd)
return function (hostname)
tls_ctx:set_ext_host_name(hostname)
if hostname then
tls_ctx:set_ext_host_name(hostname)
end
local ds1 = tls_ctx:handshake()
writefunc(ds1)
while not tls_ctx:finished() do