igrigorik / em-http-request

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

Proxy error callback missing for CONNECT #302

Closed ghost closed 4 years ago

ghost commented 8 years ago

When I use em-http-request with a proxy that requires basic auth it works when I actually get authorized. As I understand the RFC, CONNECT can also return a 407 status code when authorization is denied.

The highlighted section in the code uses socksify to generate a deferrable which only has a success callback, no error callback. The success callback is ever called and the connection is just hanging there.

https://github.com/igrigorik/em-http-request/blob/master/lib/em-http/http_connection.rb#L159-L169

Is this behaviour intentional?

igrigorik commented 7 years ago

A little late to the game here.. apologies!

You're right we don't handle the exception and that's an oversight. If you're still up for it, would love to see a PR to handle this case.

crondaemon commented 4 years ago

I would be glad to make a PR, but I'd need some guidance on it. What should be the expected behavior and where the rescue should be put?

If I make the PR, how long would it take to be released in the official gem?