I am trying to create a proxy which I can route my browser requests through
in order to gather information on the web page loading.  At this time I am
particularly interested in the many GET requests associated with loading a
single web page. Note: This does not have anything to do with rails, my goal
is to run a ruby app in the background, set firefox to proxy all requests
through it, log those requests, then return the fulfilled request back to
the browser (i.e. the web page still loads in the browser).

I posted this on a ruby forum, and it was suggested to do something along
the lines of:

require 'rubygems'
require 'mongrel'
require 'logger'

class HeaderHandler < Mongrel::HttpHandler

  @@logger = Logger.new('headers.log')

  def process(request,response)
    response.start(200) do |head, out|
      head["Content-Type"] = "text/plain"
      @@logger.info request.params
    end
  end
end



server = Mongrel::HttpServer.new("127.0.0.1", "2222")
server.register("/", HeaderHandler.new)
server.register("/favicon.ico", Mongrel::Error404Handler.new(""))
server.run.join

The problem is that this only records the first request (i.e. google.com,
and not any other requests that are associated with loading that page), and
the page is never loaded in the browser as the requests is never actually
proxied.

I have played around with this a bit, and tried changing some things up, but
I haven't really come up with anything. If anyone could point me in the
right direction, I would be grateful. Thanks!
_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to