Skip to content

Stop loading resolv from net/http - #355

Merged
hsbt merged 1 commit into
masterfrom
claude/exciting-davinci-ba31c6
Oct 14, 2026
Merged

hsbt merged 1 commit into
masterfrom
claude/exciting-davinci-ba31c6

Conversation

@hsbt

@hsbt hsbt commented Oct 14, 2026

Copy link
Copy Markdown
Member

require "net/http" loads the whole resolv library, which also reads the system DNS configuration, only to match Resolv::IPv4::Regex and Resolv::IPv6::Regex when deciding whether to send SNI. This forward-ports ruby/ruby#19316, which inlines those regexps as private constants. They are byte-identical to the copy vendored in RubyGems, so the two stay in sync.

After this, requiring net/http no longer defines Resolv or SecureRandom as a side effect, so code relying on that needs its own require. It also makes #337 unnecessary, since that approach still loads resolv on the first HTTPS connection.

Generated with Claude Code

Net::HTTP required the whole DNS resolver, which also reads the system DNS configuration at load time, only to match Resolv::IPv4::Regex and Resolv::IPv6::Regex when deciding whether to send SNI. Use the same inlined regexps as the copy vendored in RubyGems, so that the two stay identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hsbt
hsbt merged commit 7463571 into master Oct 14, 2026
52 checks passed
@hsbt
hsbt deleted the claude/exciting-davinci-ba31c6 branch October 14, 2026 03:57
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.

1 participant