Skip to content

Commit c390def

Browse files
committed
Move the unsafe verifypeer disable to own example
1 parent bf1b784 commit c390def

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

examples/https.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ func main() {
88
easy := curl.EasyInit()
99
defer easy.Cleanup()
1010
if easy != nil {
11-
easy.Setopt(curl.OPT_URL, "https://mail.google.com/")
12-
// skip_peer_verification
13-
easy.Setopt(curl.OPT_SSL_VERIFYPEER, false) // 0 is ok
14-
11+
easy.Setopt(curl.OPT_URL, "https://baidu.com/")
1512
easy.Perform()
1613
}
1714
}

examples/https_skip_peer_verify.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package main
2+
3+
import (
4+
curl "github.com/andelf/go-curl"
5+
)
6+
7+
func main() {
8+
easy := curl.EasyInit()
9+
defer easy.Cleanup()
10+
if easy != nil {
11+
easy.Setopt(curl.OPT_URL, "https://mail.google.com/")
12+
13+
// OPT_SSL_VERIFYPEER determines whether curl verifies the authenticity of the peer's certificate.
14+
// Do not disable OPT_SSL_VERIFYPEER unless you absolutely sure of the security implications.
15+
// https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html
16+
easy.Setopt(curl.OPT_SSL_VERIFYPEER, false) // 0 also means false
17+
18+
easy.Perform()
19+
}
20+
}

0 commit comments

Comments
 (0)