我在Vagrant开发环境中安装了Tinyproxy,以testingPHP应用程序传出的HTTP请求。
使用CURLE_RECV_ERROR主机名执行HTTPS请求时,curl会返回一个CURLE_RECV_ERROR (56)。
例如:
$ https_proxy=localhost:8888 curl -i "https://bogusbogus1234.com" HTTP/1.0 500 Unable to connect Server: tinyproxy/1.8.3 Content-Type: text/html Connection: close curl: (56) Received HTTP code 500 from proxy after CONNECT
我有“信息”水平日志loggingTinyproxylogging以下为上述请求。
CONNECT Jul 24 05:22:41 [9709]: Connect (file descriptor 6): myaffiliates.dev [127.0.0.1] CONNECT Jul 24 05:22:41 [9709]: Request (file descriptor 6): CONNECT bogusbogus1234.com:443 HTTP/1.1 INFO Jul 24 05:22:41 [9709]: No upstream proxy for bogusbogus1234.com ERROR Jul 24 05:22:41 [9709]: opensock: Could not retrieve info for bogusbogus1234.com INFO Jul 24 05:22:41 [9709]: no entity
如果我通过简单的HTTP执行相同的请求,即使除非来自代理的响应包含主体,否则即使所有内容都是相同的,我也不会得到curl56错误。
$ http_proxy=localhost:8888 curl -i "http://bogusbogus1234.com" HTTP/1.0 500 Unable to connect Server: tinyproxy/1.8.3 Content-Type: text/html Connection: close <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>500 Unable to connect</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <!-- ... --> </html>
…和日志…
CONNECT Jul 24 05:36:18 [9710]: Connect (file descriptor 6): myaffiliates.dev [127.0.0.1] CONNECT Jul 24 05:36:18 [9710]: Request (file descriptor 6): GET http://bogusbogus1234.com/ HTTP/1.1 INFO Jul 24 05:36:18 [9710]: No upstream proxy for bogusbogus1234.com ERROR Jul 24 05:36:24 [9710]: opensock: Could not retrieve info for bogusbogus1234.com INFO Jul 24 05:36:24 [9710]: no entity
我正在寻找的是一致的响应,因此应用程序可以识别何时对伪造主机执行请求,而不会对它与外界之间存在代理敏感。