From: John W Higgins on
[Note: parts of this message were removed to make it a legal post.]

Evening,

If you wish to run the example as is you need to run all three lines

ruby examples/appserver.rb 81 - this runs a webserver which is referenced in
line 4 of the line_interceptor example as the final destination. Think of it
as a tiny tiny version of the webserver you are trying to connect to.

ruby examples/line_interceptor.rb - this fires up the proxy - the error you
are getting is that it is trying to connect to the server started just above
which you are I'm guessing not running

curl localhost - this uses curl to make a request that hits the proxy that
then sends the request off to the appserver.rb to get the response -
modifies the result and returns it to you.

You will need rack installed to have appserver.rb work.

Hope this helps move you along......

John

From: John Yuan on
Thank you, Mr. John W Higgins.



I am not familiar with Ruby's server/proxy stuff, so I simply follow
the example (presented in the page you recommended below) before
applying my actual case.



John W Higgins wrote:

>

> Something nice and simple like this should work (

> http://github.com/igrigorik/em-proxy/blob/master/examples/line_interceptor.rb)



I am not fully understand em-proxy but when executing the example ;



# ruby examples/appserver.rb 81

# ruby examples/line_interceptor.rb



And I encountered the error when running line_interceptor ;



# ruby line_interceptor.rb

/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in
`start_tcp_server': no acceptor (RuntimeError)

from
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in
`start_server'

from
/usr/lib/ruby/gems/1.8/gems/em-proxy-0.1.2/lib/../lib/em-proxy/proxy.rb:10:in
`start'

from
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in
`call'

from
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in
`run_machine'

from
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in
`run'

from
/usr/lib/ruby/gems/1.8/gems/em-proxy-0.1.2/lib/../lib/em-proxy/proxy.rb:5:in
`start'

from line_interceptor.rb:6





Only modification I made was :



original> require 'lib/emproxy'



modified>require 'rubygems'

modified>require 'em-proxy'



I think the problem is in either "appserver.rb" or eventmachine's port
specification and googled to find :



http://whatdoesthiserrormean.com/errors/93



which currently under maintenance. I am sure it's simple installation
matter, so I would wait for while until the site back and find reported
errors, but if you could suggest my em-proxy setting-up problem, I will
appreciate very much.



John



--
Posted via http://www.ruby-forum.com/.

From: John Yuan on
Thank you Mr.Alexey Bovanenko

I think you are correct as some people suggested me the same.

> you can use proxy solution for specific sites or
> you can write paths for selected sites in gateway table on your computer.

I guess you are suggesting to deal with iptables (and/or proxy server)
and route commands to fire the particular packets to targeted site.

At this point, I prefer 100% ruby solution, but until I can make
em-proxy working, I will try debian's command line and independent proxy
server and report back here.

John

--
Posted via http://www.ruby-forum.com/.

From: John Yuan on
Thank you, Thank you, Mr. John W Higgins for very quick response.

About Curl, I could not proceed there yet, but as far as curl and rack
gem installation, it was smooth and I did not see any problem.

> ruby examples/line_interceptor.rb - this fires up the proxy - the error you
> are getting is that it is trying to connect to the server started just above
> which you are I'm guessing not running

I tested with FireFox ;

request: http://localhost:81/
respose: hello world:

So I assumed the server was working, but also I saw other comments
explaining the cause of error:

eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_tcp_server':
no acceptor (RuntimeError)


might be that the port (81) could be used. It does not make sense to
me, but somehow I might mess my port use or some connection trouble with
em-proxy. Can you think of any other possibility ?

--
Posted via http://www.ruby-forum.com/.

From: John W Higgins on
[Note: parts of this message were removed to make it a legal post.]

Morning,

On Thu, Apr 1, 2010 at 12:19 AM, John Yuan <johnyuan2000(a)gmail.com> wrote:

> Thank you, Thank you, Mr. John W Higgins for very quick response.
>
> About Curl, I could not proceed there yet, but as far as curl and rack
> gem installation, it was smooth and I did not see any problem.
>
> > ruby examples/line_interceptor.rb - this fires up the proxy - the error
> you
> > are getting is that it is trying to connect to the server started just
> above
> > which you are I'm guessing not running
>
> I tested with FireFox ;
>
> request: http://localhost:81/
> respose: hello world:
>


Are you running a web server on this system? Does firefox return anything
for http://localhost:80 ? If so then that is the problem - you will need to
change the port in the example from 80 to something else. I might have
misread your issue last night. So if you changed the proxy's port from 80 to
lets say 82 then look at http://localhost:82 you should be getting the
response from the proxy.

John