如何使用curl模拟来自Firefox的代理请求? [英] How can I use curl to simulate a request from Firefox over a proxy?
问题描述
特别是,当我将firefox设置为对https流量使用代理时,我试图复制其行为。
根据我的测试,Firefox似乎向代理发送了CONNECT请求,而以下curl命令直接将GET发送给了代理。
curl --proxy-basic mydomain.com:8001 https://www.google.com
如何针对HTTPS连接的代理,使curl表现得像firefox那样进行测试?
EDIT1:问题不是User-Agent的问题,因为我不是想让代理人以为自己是Firefox,而是只是像使用Firefox那样帮助代理服务器工作。
我已经通过
- 选择
Net
标签
-
刷新页面
-
右键单击要模拟的URL请求
-
选择cURL复制
- 您要模拟的URL请求现在位于剪贴板中。
In particular, I am attempting to replicate the behavior of firefox when I set it to use a proxy for https traffic.
From my tests, it appears that Firefox sends a CONNECT request to the proxy, while the following curl command directly sends GET to the proxy.
curl --proxy-basic mydomain.com:8001 https://www.google.com
How can I make curl behave like firefox for testing purposes with respect to the proxy for HTTPS connections?
EDIT1: The issue is not with the User-Agent, because I am not trying to fool the proxy into thinking I am firefox, only to help the proxy function the way it would with Firefox.
I've done this through Firebug.
Once you've installed firebug, follow this steps:
- Right-click a webpage inside firefox and choose this option:
- Select
Net
tab
Refresh the page
Right-click the URL request you want to simulate
Choose
copy as cURL
- The URL request that you want to simulate is now in your clipboard.
这篇关于如何使用curl模拟来自Firefox的代理请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!