Skip to content

Commit

Permalink
Update overriding code of twitter/connection.rb
Browse files Browse the repository at this point in the history
http gem 0.9.8 does not provide port number when uri_object.port is called.

Addressable::URI may be the source of this problem, however calling uri_object.default_port seems reasonable when an authority is given properly, in other words, given port and default port is same.

I monkeypatch this problem until proper fix is applied.
  • Loading branch information
nidev committed Oct 18, 2015
1 parent d99b78d commit 87de3cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rbitter/override/gems/twitter/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def initialize(options = {})

def stream(request, response)
client_context = OpenSSL::SSL::SSLContext.new
client = @tcp_socket_class.new(Resolv.getaddress(request.uri.host), request.uri.port)
client = @tcp_socket_class.new(
Resolv.getaddress(request.uri.host),
request.uri.port.nil? ? request.uri.default_port : request.uri.port)
ssl_client = @ssl_socket_class.new(client, client_context)
ssl_client.connect
request.stream(ssl_client)
Expand Down

0 comments on commit 87de3cf

Please sign in to comment.