Skip to content

Commit 842756e

Browse files
authored
Sentinels: Fix password with special characters. (#66)
1 parent edc87b7 commit 842756e

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lib/async/redis/endpoint.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def self.parse(string, endpoint = nil, **options)
6363
# @parameter scheme [String, nil] The scheme to use, e.g. "redis" or "rediss". If nil, will auto-detect.
6464
# @parameter hostname [String] The hostname to connect to (or bind to).
6565
# @parameter options [Hash] Additional options, passed to {#initialize}.
66-
def self.for(scheme, host, credentials: nil, port: nil, database: nil, **options)
66+
def self.for(scheme, host, port: nil, database: nil, **options)
6767
# Auto-detect scheme if not provided:
6868
if default_scheme = options.delete(:scheme)
6969
scheme ||= default_scheme
@@ -82,7 +82,6 @@ def self.for(scheme, host, credentials: nil, port: nil, database: nil, **options
8282
self.new(
8383
uri_klass.build(
8484
scheme: scheme,
85-
userinfo: credentials&.join(":"),
8685
host: host,
8786
port: port,
8887
path: path,

test/async/redis/endpoint.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@
106106

107107
it "handles credentials correctly" do
108108
endpoint = Async::Redis::Endpoint.for("redis", "localhost", credentials: ["user", "pass"], port: 6380)
109-
expect(endpoint.url.to_s).to be == "redis://user:pass@localhost:6380"
110-
expect(endpoint.url.userinfo).to be == "user:pass"
109+
expect(endpoint.url.to_s).to be == "redis://localhost:6380"
111110
expect(endpoint.credentials).to be == ["user", "pass"]
112111
end
113112

@@ -131,11 +130,10 @@
131130
port: 6380,
132131
database: 3
133132
)
134-
expect(endpoint.url.to_s).to be == "rediss://user:pass@[#{ipv6}]:6380/3"
133+
expect(endpoint.url.to_s).to be == "rediss://[#{ipv6}]:6380/3"
135134
expect(endpoint.url.scheme).to be == "rediss"
136135
expect(endpoint.url.host).to be == "[#{ipv6}]"
137136
expect(endpoint.url.hostname).to be == ipv6
138-
expect(endpoint.url.userinfo).to be == "user:pass"
139137
expect(endpoint.url.port).to be == 6380
140138
expect(endpoint.url.path).to be == "/3"
141139
expect(endpoint).to be(:secure?)

0 commit comments

Comments
 (0)