Closed stefansundin closed 2 years ago
port returns nil unless the port is explicitly supplied (i.e. https://github.com/ vs https://github.com:443/). If nil is used then Net:HTTP defaults to port 80. So any attempt to use https URLs would result in an error like this:
port
nil
https://github.com/
https://github.com:443/
Net:HTTP
OpenSSL::SSL::SSLError - SSL_connect returned=1 errno=0 state=error: wrong version number: /opt/homebrew/Cellar/ruby/3.0.3/lib/ruby/3.0.0/net/protocol.rb:46:in `connect_nonblock' /opt/homebrew/Cellar/ruby/3.0.3/lib/ruby/3.0.0/net/protocol.rb:46:in `ssl_socket_connect' /opt/homebrew/Cellar/ruby/3.0.3/lib/ruby/3.0.0/net/http.rb:1038:in `connect' /opt/homebrew/Cellar/ruby/3.0.3/lib/ruby/3.0.0/net/http.rb:970:in `do_start' /opt/homebrew/Cellar/ruby/3.0.3/lib/ruby/3.0.0/net/http.rb:959:in `start' /opt/homebrew/Cellar/ruby/3.0.3/lib/ruby/3.0.0/net/http.rb:1512:in `request' /opt/homebrew/Cellar/ruby/3.0.3/lib/ruby/3.0.0/net/http.rb:1422:in `request_get' /opt/homebrew/lib/ruby/gems/3.0.0/gems/opengraph_parser-0.2.4/lib/redirect_follower.rb:28:in `resolve' /opt/homebrew/lib/ruby/gems/3.0.0/gems/opengraph_parser-0.2.4/lib/open_graph.rb:30:in `parse_opengraph' /opt/homebrew/lib/ruby/gems/3.0.0/gems/opengraph_parser-0.2.4/lib/open_graph.rb:18:in `initialize'
Well, actually, you wouldn't get any error because of that rescue clause. 😖
rescue
Anyway, this fixes it. I'm surprised I didn't notice this when I submitted #20. Oh well.
port
returnsnil
unless the port is explicitly supplied (i.e.https://github.com/
vshttps://github.com:443/
). Ifnil
is used thenNet:HTTP
defaults to port 80. So any attempt to use https URLs would result in an error like this:Well, actually, you wouldn't get any error because of that
rescue
clause. 😖Anyway, this fixes it. I'm surprised I didn't notice this when I submitted #20. Oh well.