3

I usually use Fiddler to monitor HTTP request and response, but if it is a Ruby script using Net/HTTP, all the request and response won't show up in Fiddler.

Is there a way to see all the request and response, and if Fiddler can't do it, can any other tool on Mac or Linux show it?

nonopolarity
  • 146,324
  • 131
  • 460
  • 740

3 Answers3

8

You want to use the Net::Http::Proxy library in your Ruby script.

Where you have

Net::Http.start(uri.host, uri.port)

you want

Net::HTTP::Proxy('127.0.0.1', '8888').start(uri.host, uri.port)

. . . assuming Fiddler is running on port 8888, as it does out of the box.

3

Have you tried WireShark?

And maybe you can get Fiddler to work by using a proxy - sending net/http to 127.0.0.1:8888 for instance.

Michiel de Mare
  • 41,982
  • 29
  • 103
  • 134
-1

In this instance, I would use Firefox (Firebug) or Chrome (built in developer tools) to do this

(update: a working answer in the comment)

nonopolarity
  • 146,324
  • 131
  • 460
  • 740
curv
  • 3,796
  • 4
  • 33
  • 48
  • as long as it's coming through the browser then yes. Do you mean you are running a stand alone Ruby script from the command line? – curv Feb 28 '11 at 09:34
  • I am using a Ruby script to fetch from www.somewhereonnet.com... it is not a local server – nonopolarity Feb 28 '11 at 09:39
  • Ah... In that case Fiddler can not do it. Fiddler needs to 'bind' on to a browser in order to record requests. Try this I think it is what you need - http://www.commandlinefu.com/commands/view/1850/show-live-http-requests-being-made-on-os-x – curv Feb 28 '11 at 09:50