Skip to content

Commit b01a302

Browse files
committed
net.http: fix compilation of trivial examples with v -cflags -Werror
1 parent 7c97b0b commit b01a302

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

vlib/net/http/backend_nix.c.v

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const (
1212

1313
fn (req &Request) ssl_do(port int, method Method, host_name string, path string) ?Response {
1414
// ssl_method := C.SSLv23_method()
15-
ssl_method := C.TLSv1_2_method()
16-
ctx := C.SSL_CTX_new(ssl_method)
15+
ctx := C.SSL_CTX_new(C.TLSv1_2_method())
1716
C.SSL_CTX_set_verify_depth(ctx, 4)
1817
flags := C.SSL_OP_NO_SSLv2 | C.SSL_OP_NO_SSLv3 | C.SSL_OP_NO_COMPRESSION
1918
C.SSL_CTX_set_options(ctx, flags)
@@ -24,21 +23,21 @@ fn (req &Request) ssl_do(port int, method Method, host_name string, path string)
2423
ssl := &openssl.SSL(0)
2524
C.BIO_get_ssl(web, &ssl)
2625
preferred_ciphers := 'HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4'
27-
res = C.SSL_set_cipher_list(ssl, preferred_ciphers.str)
26+
res = C.SSL_set_cipher_list(voidptr(ssl), preferred_ciphers.str)
2827
if res != 1 {
2928
println('http: openssl: cipher failed')
3029
}
31-
res = C.SSL_set_tlsext_host_name(ssl, host_name.str)
30+
res = C.SSL_set_tlsext_host_name(voidptr(ssl), host_name.str)
3231
res = C.BIO_do_connect(web)
3332
if res != 1 {
3433
return error('cannot connect the endpoint')
3534
}
3635
res = C.BIO_do_handshake(web)
37-
C.SSL_get_peer_certificate(ssl)
38-
res = C.SSL_get_verify_result(ssl)
36+
C.SSL_get_peer_certificate(voidptr(ssl))
37+
res = C.SSL_get_verify_result(voidptr(ssl))
3938
// /////
4039
req_headers := req.build_request_headers(method, host_name, path)
41-
//println(req_headers)
40+
// println(req_headers)
4241
C.BIO_puts(web, req_headers.str)
4342
mut content := strings.new_builder(100)
4443
mut buff := [bufsize]byte{}

0 commit comments

Comments
 (0)