net.http: support -d no_vschannel on windows, to fix long waits, while connecting on some systems (#20265)

This commit is contained in:
koplenov 2023-12-28 12:49:25 +03:00 committed by GitHub
parent b944927f09
commit 76e1ac3db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,13 @@ import net.ssl
import strings import strings
fn (req &Request) ssl_do(port int, method Method, host_name string, path string) !Response { fn (req &Request) ssl_do(port int, method Method, host_name string, path string) !Response {
$if windows && !no_vschannel ? {
return vschannel_ssl_do(req, port, method, host_name, path)
}
return net_ssl_do(req, port, method, host_name, path)
}
fn net_ssl_do(req &Request, port int, method Method, host_name string, path string) !Response {
mut ssl_conn := ssl.new_ssl_conn( mut ssl_conn := ssl.new_ssl_conn(
verify: req.verify verify: req.verify
cert: req.cert cert: req.cert

View File

@ -15,7 +15,7 @@ pub struct C.TlsContext {}
fn C.new_tls_context() C.TlsContext fn C.new_tls_context() C.TlsContext
fn (req &Request) ssl_do(port int, method Method, host_name string, path string) !Response { fn vschannel_ssl_do(req &Request, port int, method Method, host_name string, path string) !Response {
mut ctx := C.new_tls_context() mut ctx := C.new_tls_context()
C.vschannel_init(&ctx) C.vschannel_init(&ctx)
mut buff := unsafe { malloc_noscan(C.vsc_init_resp_buff_size) } mut buff := unsafe { malloc_noscan(C.vsc_init_resp_buff_size) }