Skip to content

Conversation

@stanhu
Copy link
Contributor

@stanhu stanhu commented Jan 6, 2026

When passing a rediss:// URL to SentinelConfig, the SSL setting was not being extracted from the URL scheme, causing SSL connections to fail silently. This was inconsistent with the regular Config class, which correctly extracts the SSL parameter.

The issue was in the URL parsing logic where ssl: url_config.ssl? was missing from the client_config hash that's built from the URL.

This commit adds the missing SSL extraction and includes a test to verify that rediss:// URLs properly enable SSL for master/replica connections while keeping Sentinel connections unaffected.

@stanhu stanhu force-pushed the sh-pass-ssl-sentinel branch from 11f84ca to 370b7db Compare January 6, 2026 17:56
When passing a `rediss://` URL to SentinelConfig, the SSL setting was
not being extracted from the URL scheme, causing SSL connections to fail
silently. This was inconsistent with the regular Config class, which
correctly extracts the SSL parameter.

The issue was in the URL parsing logic where `ssl: url_config.ssl?` was
missing from the client_config hash that's built from the URL.

This commit adds the missing SSL extraction and includes a test to
verify that rediss:// URLs properly enable SSL for master/replica
connections while keeping Sentinel connections unaffected.
@stanhu stanhu force-pushed the sh-pass-ssl-sentinel branch from 370b7db to 2549889 Compare January 6, 2026 18:03
@byroot byroot merged commit 7e87c1c into redis-rb:master Jan 6, 2026
13 of 15 checks passed
stanhu added a commit to stanhu/redis-client that referenced this pull request Jan 8, 2026
PR redis-rb#277 fixed the issue where `ssl` was not set on the Redis client
automatically if a `rediss://` URl were used:

```ruby
require 'redis'

config = {
    url: 'rediss://mymaster',
    sentinels: [
      { host: 'localhost', port: 26379, ssl: true } ,
      { host: 'localhost', port: 26381, ssl: true },
      { host: 'localhost', port: 26380, ssl: true }
    ]
  }
  client = Redis.new(config)
````

However, it broke the case if you explicitly set `ssl` and expected for
it to propagate:

```ruby
require 'redis'

config = {
    name: 'mymaster',
    ssl: true,
    sentinels: [
      { host: 'localhost', port: 26379 },
      { host: 'localhost', port: 26381 },
      { host: 'localhost', port: 26380 }
    ]
  }
  client = Redis.new(config)
````

Closes redis-rb#279
stanhu added a commit to stanhu/redis-client that referenced this pull request Jan 8, 2026
PR redis-rb#277 fixed the issue where `ssl` was not set on the Redis client
automatically if a `rediss://` URl were used:

```ruby
require 'redis'

config = {
    url: 'rediss://mymaster',
    sentinels: [
      { host: 'localhost', port: 26379, ssl: true } ,
      { host: 'localhost', port: 26381, ssl: true },
      { host: 'localhost', port: 26380, ssl: true }
    ]
  }
  client = Redis.new(config)
````

However, it broke the case if you explicitly set `ssl` and expected it
to propagate:

```ruby
require 'redis'

config = {
    name: 'mymaster',
    ssl: true,
    sentinels: [
      { host: 'localhost', port: 26379 },
      { host: 'localhost', port: 26381 },
      { host: 'localhost', port: 26380 }
    ]
  }
  client = Redis.new(config)
````

Closes redis-rb#279
stanhu added a commit to stanhu/redis-client that referenced this pull request Jan 8, 2026
PR redis-rb#277 fixed the issue where `ssl` was not set on the Redis client
automatically if a `rediss://` URl were used:

```ruby
require 'redis'

config = {
    url: 'rediss://mymaster',
    sentinels: [
      { host: 'localhost', port: 26379, ssl: true } ,
      { host: 'localhost', port: 26381, ssl: true },
      { host: 'localhost', port: 26380, ssl: true }
    ]
  }
  client = Redis.new(config)
````

However, it broke the case if you explicitly set `ssl` and expected it
to propagate:

```ruby
require 'redis'

config = {
    name: 'mymaster',
    ssl: true,
    sentinels: [
      { host: 'localhost', port: 26379 },
      { host: 'localhost', port: 26381 },
      { host: 'localhost', port: 26380 }
    ]
  }
  client = Redis.new(config)
````

Closes redis-rb#279
stanhu added a commit to stanhu/redis-client that referenced this pull request Jan 8, 2026
PR redis-rb#277 fixed the issue where `ssl` was not set on the Redis client
automatically if a `rediss://` URl were used:

```ruby
require 'redis'

config = {
    url: 'rediss://mymaster',
    sentinels: [
      { host: 'localhost', port: 26379, ssl: true } ,
      { host: 'localhost', port: 26381, ssl: true },
      { host: 'localhost', port: 26380, ssl: true }
    ]
  }
  client = Redis.new(config)
````

However, it broke the case if you explicitly set `ssl` and expected it
to propagate:

```ruby
require 'redis'

config = {
    name: 'mymaster',
    ssl: true,
    sentinels: [
      { host: 'localhost', port: 26379 },
      { host: 'localhost', port: 26381 },
      { host: 'localhost', port: 26380 }
    ]
  }
  client = Redis.new(config)
````

Closes redis-rb#279
stanhu added a commit to stanhu/redis-client that referenced this pull request Jan 8, 2026
PR redis-rb#277 fixed the issue where `ssl` was not set on the Redis client
automatically if a `rediss://` URl were used:

```ruby
require 'redis'

config = {
    url: 'rediss://mymaster',
    sentinels: [
      { host: 'localhost', port: 26379, ssl: true } ,
      { host: 'localhost', port: 26381, ssl: true },
      { host: 'localhost', port: 26380, ssl: true }
    ]
  }
  client = Redis.new(config)
````

However, it broke the case if you explicitly set `ssl` and expected it
to propagate:

```ruby
require 'redis'

config = {
    name: 'mymaster',
    ssl: true,
    sentinels: [
      { host: 'localhost', port: 26379 },
      { host: 'localhost', port: 26381 },
      { host: 'localhost', port: 26380 }
    ]
  }
  client = Redis.new(config)
````

Closes redis-rb#279
stanhu added a commit to stanhu/redis-client that referenced this pull request Jan 8, 2026
PR redis-rb#277 fixed the issue where `ssl` was not set on the Redis client
automatically if a `rediss://` URl were used:

```ruby
require 'redis'

config = {
    url: 'rediss://mymaster',
    sentinels: [
      { host: 'localhost', port: 26379, ssl: true } ,
      { host: 'localhost', port: 26381, ssl: true },
      { host: 'localhost', port: 26380, ssl: true }
    ]
  }
  client = Redis.new(config)
````

However, it broke the case if you explicitly set `ssl` and expected it
to propagate:

```ruby
require 'redis'

config = {
    name: 'mymaster',
    ssl: true,
    sentinels: [
      { host: 'localhost', port: 26379 },
      { host: 'localhost', port: 26381 },
      { host: 'localhost', port: 26380 }
    ]
  }
  client = Redis.new(config)
````

Closes redis-rb#279
stanhu added a commit to stanhu/redis-client that referenced this pull request Jan 8, 2026
PR redis-rb#277 fixed the issue where `ssl` was not set on the Redis client
automatically if a `rediss://` URl were used:

```ruby
require 'redis'

config = {
    url: 'rediss://mymaster',
    sentinels: [
      { host: 'localhost', port: 26379, ssl: true } ,
      { host: 'localhost', port: 26381, ssl: true },
      { host: 'localhost', port: 26380, ssl: true }
    ]
  }
  client = Redis.new(config)
````

However, it broke the case if you explicitly set `ssl` and expected it
to propagate:

```ruby
require 'redis'

config = {
    name: 'mymaster',
    ssl: true,
    sentinels: [
      { host: 'localhost', port: 26379 },
      { host: 'localhost', port: 26381 },
      { host: 'localhost', port: 26380 }
    ]
  }
  client = Redis.new(config)
````

Closes redis-rb#279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants