Repository navigation
Conversation
Modern virtual hosts need the server_name extension; without it OpenSSL completes against the default certificate (or the server aborts). Set it in both the async memory-BIO path and the blocking *_wait path, and skip it for IP literals as RFC 6066 requires.
Antruly
added a commit
to Antruly/uvscope
that referenced
this pull request
Oct 19, 2026
Apply patches/upstream/*.patch in name order and fail closed when a patch neither applies nor is already present. Record the reproduction, root cause and verification for each fix in docs/LIBUVCPP_UPSTREAM.zh-CN.md. Submitted upstream as Antruly/libuvcpp#38, #39 and #40.
Antruly
added a commit
that referenced
this pull request
Oct 19, 2026
uvcpp_ssl 没有暴露 SSL_set_tlsext_host_name,异步 memory-BIO 与同步阻塞两条 客户端路径都不发 server_name:现代虚拟主机会在握手阶段失败,或者返回该 IP 的 默认证书、随后在主机名校验上失败(uvp#274 / upstream #38)。 - uvcpp_ssl::set_server_name():纯增量 API,调用 SSL_set_tlsext_host_name(); - apply_tls_hostname() 与 do_ssl_handshake() 都在握手前调用它; - 按 RFC 6066 §3,IP 字面量不发 SNI(判据复用 uv_ip4_addr / uv_ip6_addr 快路径)。
Owner
Author
|
Content merged via #40. Closing to avoid duplicate merges. |
9 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
现代 HTTPS 虚拟主机依赖 TLS SNI。v1.8.0 的
uvcpp_ssl没有暴露/调用SSL_set_tlsext_host_name(),两条客户端路径都不发送server_name:src/net/uvcpp_tcp_client.cpp的apply_tls_hostname();src/web/uvcpp_http_client.cpp的do_ssl_handshake()。同步路径自己
new uvcpp_ssl(ctx, fd),不经过uvcpp_tcp_client::connect(),所以两条路必须各接一次。实际表现是握手失败,或者拿到该 IP 的默认证书后主机名校验失败。
修改
uvcpp_ssl::set_server_name(const char*, size_t),内部调用SSL_set_tlsext_host_name()。uv_ip4_addr/uv_ip6_addr判定);证书主机名校验保持原样。复现与验证(Linux x64)
本地 TLS 服务端用
SSLContext.sni_callback记录server_name:connect()localhostlocalhostconnect()127.0.0.1Noneconnect_wait()localhostlocalhostconnect_wait()127.0.0.1None两条路径在开启 SNI 后都完成握手并拿到正常响应。
兼容性