如何使用curl模拟来自Firefox的代理请求? [英] How can I use curl to simulate a request from Firefox over a proxy?

查看:247
本文介绍了如何使用curl模拟来自Firefox的代理请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

特别是,当我将firefox设置为对https流量使用代理时,我试图复制其行为。



根据我的测试,Firefox似乎向代理发送了CONNECT请求,而以下curl命令直接将GET发送给了代理。

  curl --proxy-basic mydomain.com:8001 https://www.google.com 

如何针对HTTPS连接的代理,使curl表现得像firefox那样进行测试?



EDIT1:问题不是User-Agent的问题,因为我不是想让代理人以为自己是Firefox,而是只是像使用Firefox那样帮助代理服务器工作。

解决方案

我已经通过


  1. 选择 Net 标签


  1. 刷新页面


  2. 右键单击要模拟的URL请求


  3. 选择cURL复制



  1. 您要模拟的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:

  1. Right-click a webpage inside firefox and choose this option:

  1. Select Net tab

  1. Refresh the page

  2. Right-click the URL request you want to simulate

  3. Choose copy as cURL

  1. The URL request that you want to simulate is now in your clipboard.

这篇关于如何使用curl模拟来自Firefox的代理请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆