Skip to content

Commit 0abdada

Browse files
authored
Merge branch 'master' into connection_issue
2 parents ae6dfd2 + 3d4310a commit 0abdada

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

options.go

+4
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ func NewDialer(opt *Options) func(context.Context, string, string) (net.Conn, er
267267
// URL attributes (scheme, host, userinfo, resp.), query parameters using these
268268
// names will be treated as unknown parameters
269269
// - unknown parameter names will result in an error
270+
// - use "skip_verify=true" to ignore TLS certificate validation
270271
//
271272
// Examples:
272273
//
@@ -487,6 +488,9 @@ func setupConnParams(u *url.URL, o *Options) (*Options, error) {
487488
if q.err != nil {
488489
return nil, q.err
489490
}
491+
if o.TLSConfig != nil && q.has("skip_verify") {
492+
o.TLSConfig.InsecureSkipVerify = q.bool("skip_verify")
493+
}
490494

491495
// any parameters left?
492496
if r := q.remaining(); len(r) > 0 {

options_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ func TestParseURL(t *testing.T) {
3030
}, {
3131
url: "rediss://localhost:123",
3232
o: &Options{Addr: "localhost:123", TLSConfig: &tls.Config{ /* no deep comparison */ }},
33+
}, {
34+
url: "rediss://localhost:123/?skip_verify=true",
35+
o: &Options{Addr: "localhost:123", TLSConfig: &tls.Config{InsecureSkipVerify: true}},
3336
}, {
3437
url: "redis://:bar@localhost:123",
3538
o: &Options{Addr: "localhost:123", Password: "bar"},

0 commit comments

Comments
 (0)