Skip to content

Commit

Permalink
net.http: support -d no_vschannel on windows, to fix long waits, wh…
Browse files Browse the repository at this point in the history
…ile connecting on some systems (#20265)
  • Loading branch information
koplenov committed Dec 28, 2023
1 parent b944927 commit 76e1ac3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions vlib/net/http/backend_nix.c.v → vlib/net/http/backend.c.v
Expand Up @@ -7,6 +7,13 @@ import net.ssl
import strings

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(
verify: req.verify
cert: req.cert
Expand Down
Expand Up @@ -15,7 +15,7 @@ pub struct 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()
C.vschannel_init(&ctx)
mut buff := unsafe { malloc_noscan(C.vsc_init_resp_buff_size) }
Expand Down

0 comments on commit 76e1ac3

Please sign in to comment.