Curl 如何配置Squid以支持HTTPS?

Curl 如何配置Squid以支持HTTPS?,curl,https,squid,Curl,Https,Squid,我已经安装了一个Squid服务器来部署我的网络爬虫 对于HTTP URL,Squid工作得非常好,例如: curl -is -L http://www.baidu.com --proxy http://<squid_address>:3129 curl-is-Lhttp://www.baidu.com --代理http://:3129 返回百度索引页面的来源 然而,当我尝试连接到HTTPS URL时,一些奇怪的事情发生了。以下curl命令只返回一些无用的HTML代码: cur

我已经安装了一个Squid服务器来部署我的网络爬虫

对于HTTP URL,Squid工作得非常好,例如:

curl -is -L http://www.baidu.com  --proxy http://<squid_address>:3129
curl-is-Lhttp://www.baidu.com  --代理http://:3129
返回百度索引页面的来源

然而,当我尝试连接到HTTPS URL时,一些奇怪的事情发生了。以下curl命令只返回一些无用的HTML代码:

curl -is -L https://www.baidu.com  --proxy http://<squid_address>:3129
curl-is-Lhttps://www.baidu.com  --代理http://:3129
结果(包括响应标题):

HTTP/1.1200正常
服务器:bfe/1.0.8.14
日期:2016年3月4日星期五01:24:26 GMT
内容类型:text/html
内容长度:227
连接:保持活力
最后修改:2014年10月9日星期四10:47:57 GMT
设置Cookie:BD_NOT_HTTPS=1;路径=/;最大年龄=300
设置Cookie:BIDUPSID=4617F4EBA3F7D1A94B06FFE0B72E02B7;expires=Thu,37年12月31日23:55:55 GMT;最大年龄=2147483647;路径=/;域名=.baidu.com
设置Cookie:PSTM=1457054666;expires=Thu,37年12月31日23:55:55 GMT;最大年龄=2147483647;路径=/;域名=.baidu.com
设置Cookie:BDSVRTM=0;路径=/
P3P:CP=“OTI DSP COR IVA我们的IND COM”
X-UA-兼容:IE=Edge,chrome=1
Pragma:没有缓存
缓存控制:没有缓存
BDPAGETYPE:1
BDQID:0xd7f5c039000f7c84
BDUSERID:0
接受范围:字节
设置Cookie:uuu bsi=16735848709246631383_00_175_N_1_0303_C02F_N_N_Y_0;expires=Fri,2016年3月4日01:24:31 GMT;域名=www.baidu.com;路径=/
location.replace(location.href.replace(“https://”、“http://”);
我知道原因可能是百度服务器检测到传入连接未使用HTTPS(请参阅
BD\u not\u HTTPS=1
cookie)

如何配置Squid服务器,使其能够支持HTTPS URL来解决此问题

HTTP/1.1 200 OK
Server: bfe/1.0.8.14
Date: Fri, 04 Mar 2016 01:24:26 GMT
Content-Type: text/html
Content-Length: 227
Connection: keep-alive
Last-Modified: Thu, 09 Oct 2014 10:47:57 GMT
Set-Cookie: BD_NOT_HTTPS=1; path=/; Max-Age=300
Set-Cookie: BIDUPSID=4617F4EBA3F7D1A94B06FFE0B72E02B7; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: PSTM=1457054666; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com
Set-Cookie: BDSVRTM=0; path=/
P3P: CP=" OTI DSP COR IVA OUR IND COM "
X-UA-Compatible: IE=Edge,chrome=1
Pragma: no-cache
Cache-control: no-cache
BDPAGETYPE: 1
BDQID: 0xd7f5c039000f7c84
BDUSERID: 0
Accept-Ranges: bytes
Set-Cookie: __bsi=16735848709246631383_00_175_N_N_1_0303_C02F_N_N_Y_0; expires=Fri, 04-Mar-16 01:24:31 GMT; domain=www.baidu.com; path=/

<html>
<head>
        <script>
                location.replace(location.href.replace("https://","http://"));
        </script>
</head>
<body>
        <noscript><meta http-equiv="refresh" content="0;url=http://www.baidu.com/"></noscript>
</body>
</html>