diff --git a/cluster.go b/cluster.go index d20295c7d..941838dd0 100644 --- a/cluster.go +++ b/cluster.go @@ -217,6 +217,7 @@ func setupClusterConn(u *url.URL, host string, o *ClusterOptions) (*ClusterOptio func setupClusterQueryParams(u *url.URL, o *ClusterOptions) (*ClusterOptions, error) { q := queryOptions{q: u.Query()} + o.Protocol = q.int("protocol") o.ClientName = q.string("client_name") o.MaxRedirects = q.int("max_redirects") o.ReadOnly = q.bool("read_only") diff --git a/cluster_test.go b/cluster_test.go index 75ea40df1..d3b4474a2 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -1519,6 +1519,10 @@ var _ = Describe("ClusterClient ParseURL", func() { test: "UseDefault", url: "redis://localhost:123?conn_max_idle_time=", o: &redis.ClusterOptions{Addrs: []string{"localhost:123"}, ConnMaxIdleTime: 0}, + }, { + test: "Protocol", + url: "redis://localhost:123?protocol=2", + o: &redis.ClusterOptions{Addrs: []string{"localhost:123"}, Protocol: 2}, }, { test: "ClientName", url: "redis://localhost:123?client_name=cluster_hi",