@@ -12,8 +12,7 @@ const (
12
12
13
13
fn (req &Request) ssl_do (port int , method Method, host_name string , path string ) ? Response {
14
14
// 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 ())
17
16
C.SSL_CTX_set_verify_depth (ctx, 4 )
18
17
flags := C.SSL_OP_NO_SSLv2 | C.SSL_OP_NO_SSLv3 | C.SSL_OP_NO_COMPRESSION
19
18
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)
24
23
ssl := & openssl.SSL (0 )
25
24
C.BIO_get_ssl (web, & ssl)
26
25
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)
28
27
if res != 1 {
29
28
println ('http: openssl: cipher failed' )
30
29
}
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)
32
31
res = C.BIO_do_connect (web)
33
32
if res != 1 {
34
33
return error ('cannot connect the endpoint' )
35
34
}
36
35
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) )
39
38
// /////
40
39
req_headers := req.build_request_headers (method, host_name, path)
41
- // println(req_headers)
40
+ // println(req_headers)
42
41
C.BIO_puts (web, req_headers.str)
43
42
mut content := strings.new_builder (100 )
44
43
mut buff := [bufsize]byte {}
0 commit comments