igrigorik / em-http-request

Asynchronous HTTP Client (EventMachine + Ruby)
1.22k stars 222 forks source link

Pass default port if port is nil #278

Closed glebtv closed 8 years ago

glebtv commented 9 years ago

Addressable::URI returns nil for port, if it is not provided in an URI So, .default_port should be used instead

Because of this, URIs without port part do not work with SOCKS proxies.

> Addressable::URI.parse('http://test.ru').port
=> nil
> Addressable::URI.parse('http://test.ru').default_port
=> 80

Ref: https://github.com/sporkmonger/addressable/issues/179

igrigorik commented 9 years ago

Can you add a test case for this case? It's not clear to me what impact this has on other parts of the code, which is also accessing uri.port.

igrigorik commented 8 years ago

Resolved in https://github.com/igrigorik/em-http-request/commit/74efe8e3447ee16a22d00fa9cf1d0224dae09db7, closing.