开发者

If using Ruby with Net/HTTP, how to monitor its traffic using Fiddler on Windows or another tool on Mac / Linux?

开发者 https://www.devze.com 2023-02-13 16:35 出处:网络
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.

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?


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.


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.


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

(update: a working answer in the comment)

0

精彩评论

暂无评论...
验证码 换一张
取 消