Updated examples/http_proxy.rb #19

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@JohnMurray

The current example was not compatible with Ruby 1.8.7 due to use of
the 'String#clear' method. Also, I added a note to let the user know
that if they would like to use this example as a starting point, they
should remove all the 'puts' statements for performance and also to
avoid the return of corrupt images(as is such in the case of loading
maps.google.com through the proxy).

@JohnMurray JohnMurray Updated examples/http_proxy.rb
The current example was not compatible with Ruby 1.8.7 due to use of
the 'String#clear' method. Also, I added a note to let the user know
that if they would like to use this example as a starting point, they
should remove all the 'puts' statements for performance and also to
avoid the return of corrupt images(as is such in the case of loading
maps.google.com through the proxy).
e19bfba
@igrigorik
Owner

Hmm, trying to understand why the puts statements would cause corrupt images? That seems rather bizzarre.

Also, http_proxy.rb is definitely an example, not a robust implementation.

@JohnMurray

Yes it is very bizzarre. I'd recommend that you try it out yourself. And although it is just an example, it is not an example that works for a very simple practical purpose (viewing a web-page with multiple images). That's why my commit only includes a simple note that details such.

As a beginner to EventMachine and em-proxy, it was very confusing and frustrating trying to figure out why even the example would not work for me.

@igrigorik
Owner

I guess it's all relative. :-)

Google Maps is hardly a simple web app to render -- we're talking a mountain of javascript, image tiles, and all the rest. If anything, I'm surprised it worked at all.

@JohnMurray JohnMurray closed this Dec 21, 2011
@antoinerg

Why are you surprised it worked at all? A proxy should handle that without problem.

The example provided is still giving me weird images and problems. I wonder if it's due to a bad parsing of the headers.

@igrigorik
Owner

There is much more to building a proper HTTP proxy than meets the eye. If you want to shuffle bytes between sockets, then that's easy, but parsing HTTP and taking care of all of the edge case is non-trivial at best.

Really, I should remove this example outright, since it gives a false sense that the demo is a workable solution.

em-proxy is a layer 3 proxy, anything above you're on your own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment