voloko/twitter-stream

Proxy support?

bgreenlee opened this issue · 6 comments

It doesn't appear that twitter-stream and/or EventMachine supports http proxies. Is that right?

I think you can. By passing proxy ip address as a host parameter and sending stream.twitter.com into the Host: http header. Thought you have to add additional option to options hash.

But you have to manually update http://github.com/voloko/twitter-stream/blob/master/lib/twitter/json_stream.rb#L164

Share if you do the fork

http://github.com/voloko/twitter-stream/blob/master/lib/twitter/json_stream.rb#L164

I tried that, but it's not working (our proxy is sending back 400 Bad Request). Looking at http://github.com/igrigorik/em-http-request, I think it's a bit more complicated than that. I think I'll see if I can get something working with em-http-request.

hmm. It looks like it does exactly the same thing with the request: http://github.com/igrigorik/em-http-request/blob/master/lib/em-http/request.rb#L61

Anyway, if you find the solution, let me know. It might be useful to add this to twitter-stream

I did. But the code you showing has nothing to do with the request. Its about response parsing.

The problem turned out to be that proxies need to have the full url in the request, not just the path. Fixed: http://github.com/bgreenlee/twitter-stream/commit/6a06df789c070fa47f2313974b8d384ab0a8fab7