Created
May 15, 2017 16:09
-
-
Save lietu/91c74b1f739a1dea7bdc6978d6e40e41 to your computer and use it in GitHub Desktop.
Reproducible problem with Rubygems when using FREEDOME
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This minimal script seems to reproduce the issue with Rubygems | |
# | |
# It seems Ruby DNS resolver does something odd, as when FREEDOME is on, this | |
# fails with a SocketError, and when FreeDOME is off it fails with a | |
# Resolv::ResolvError. | |
# | |
# This code is built based on Rubygems source code: | |
# https://github.com/rubygems/rubygems/blob/v2.3.0/lib/rubygems/remote_fetcher.rb#L92-L93 | |
# | |
# That code is in the backtrace of `gem install --backtrace jekyll` when this error happens. | |
# | |
require 'resolv' | |
host = "rubygems.org" | |
dns = Resolv::DNS.new | |
begin | |
dns.getresource "_rubygems._tcp.#{host}", Resolv::DNS::Resource::IN::SRV | |
rescue Resolv::ResolvError => e | |
puts "FREEDOME is off" | |
rescue SocketError | |
puts "FREEDOME is on" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment