Skip to content

ssl: add SSLSocket#add_certificate - #1149

Open
kou wants to merge 1 commit into
ruby:masterfrom
kou:ssl-socket-add-certificate
Open

kou wants to merge 1 commit into
ruby:masterfrom
kou:ssl-socket-add-certificate

Conversation

@kou

@kou kou commented Nov 11, 2026

Copy link
Copy Markdown
Member

Allow adding a certificate per connection. This is the SSLSocket counterpart of SSLContext#add_certificate.

This is a step toward configuring the SSL object directly from callbacks instead of switching the SSLContext.

Ref #1125

Comment thread test/openssl/test_ssl.rb
server_connect(port) { |ssl|
assert_equal [@svr_cert.subject, @ca_cert.subject],
ssl.peer_cert_chain.map(&:subject)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test failures are relevant. In TLS 1.3, SSL_connect() may return before SSL_accept() finishes writing NewSessionTicket. The usual workaround is to complete an application data round trip (ssl.puts("abc"); ssl.gets) to avoid the RST.

Maybe it's time to clean this up, since the same workaround is repeated in quite a few tests. But it would not belong to this PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry. You're right. I've added one round trip and CI is green now.

Let's discuss how to clean this up as a separated task.

Allow adding a certificate per connection. This is the SSLSocket
counterpart of SSLContext#add_certificate.

This is a step toward configuring the SSL object directly from
callbacks instead of switching the SSLContext.

Ref ruby#1125

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kou
kou force-pushed the ssl-socket-add-certificate branch from bb72f9b to f5fbd44 Compare November 11, 2026 11:39

This branch has not been deployed

No deployments
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