diff --git a/vlib/net/http/backend_nix.c.v b/vlib/net/http/backend.c.v similarity index 87% rename from vlib/net/http/backend_nix.c.v rename to vlib/net/http/backend.c.v index 0a28406511..19924e5169 100644 --- a/vlib/net/http/backend_nix.c.v +++ b/vlib/net/http/backend.c.v @@ -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 diff --git a/vlib/net/http/backend_windows.c.v b/vlib/net/http/backend_vschannel_windows.c.v similarity index 91% rename from vlib/net/http/backend_windows.c.v rename to vlib/net/http/backend_vschannel_windows.c.v index 6ecd26dec3..50c6b49ef8 100644 --- a/vlib/net/http/backend_windows.c.v +++ b/vlib/net/http/backend_vschannel_windows.c.v @@ -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) }