| Recommend this page to a friend! |
| PHP HTTP protocol client | > | All threads | > | https site and Squid proxy | > | (Un) Subscribe thread alerts |
| |||||||||||||||
I'm trying to connect to a https site but when using a Squid proxy, the response is always :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The requested URL could not be retrieved</TITLE> <STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE> </HEAD><BODY> <H1>ERROR</H1> <H2>The requested URL could not be retrieved</H2> <HR noshade size="1px"> <P> While trying to retrieve the URL: <A HREF="https://www.openssl.org/">https://www.openssl.org/</A> <P> The following error was encountered: <UL> <LI> <STRONG> Unsupported Request Method and Protocol </STRONG> </UL> <P> Squid does not support all request methods for all access protocols. For example, you can not POST a Gopher request. <P>Your cache administrator is <A HREF="mailto:webmaster">webmaster</A>. <BR clear="all"> <HR noshade size="1px"> <ADDRESS> Generated Sun, 16 Mar 2008 11:15:02 GMT by proxy (squS id/2.5.STABLE11) </ADDRESS> </BODY></HTML> id/2.5.STABLE11) </ADDRESS> </BODY></HTML> I try to validate the proxy by using software then the response is "HTTP/1.0 200 Connection established". That mean the proxy server works after googling I get this : squid-cache.org/mail-archive/squid- ...Can you explain it for me please ? Thanks.
It is hard to tell what is your problem without seeing the debug log of what is sent and received from the server.
The class supports accessing SSL servers via HTTP proxies since last month. Maybe your problem is that you are using an old version.
I'm so sorry that it was my stupid ! I haven't enabled the socket transport SSL. Now everything is fine. Thank you very much for your help :)
$url="http://google.com";
$arguments["ProxyHostName"]="85.186.159.233"; $arguments["ProxyHostPort"]=8080; I'm confused again :( I think that the CONNECT is for using proxy and HTTPS connection only but after adding a proxy server then whether the protocol is "HTTP" or "HTTPS", the script will automatically switch to CONNECT method, which leads to endless redirection or return message "unable to send request via proxy". ________________________ Test for Manuel Lemos' PHP HTTP class * Opening connection to: google.com Connecting to google.com Connecting to HTTP proxy server IP 85.186.159.233 port 8080... Connected to 85.186.159.233 * Sending request for page: / C CONNECT google.com:443 HTTP/1.0 C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.0 200 Connection established S C GET / HTTP/1.1 C Host: google.com C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C Pragma: nocache C * Request: GET / HTTP/1.1 * Request headers: Host: google.com User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Pragma: nocache S HTTP/1.1 302 Found S Location: http://www.google.com S Date: Mon, 17 Mar 2008 10:51:56 GMT S Content-Type: text/html; charset=UTF-8 S Server: GFE/1.3 S Content-Length: 218 S Disconnected from google.com Connecting to www.google.com Connecting to HTTP proxy server IP 85.186.159.233 port 8080... Connected to 85.186.159.233 C CONNECT www.google.com:443 HTTP/1.0 C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.0 200 Connection established S C GET / HTTP/1.1 C Host: www.google.com C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.1 302 Found S Location: http://www.google.com S Date: Mon, 17 Mar 2008 10:52:05 GMT S Content-Type: text/html; charset=UTF-8 S Server: GFE/1.3 S Content-Length: 218 S Disconnected from www.google.com Connecting to www.google.com Connecting to HTTP proxy server IP 85.186.159.233 port 8080... Connected to 85.186.159.233 C CONNECT www.google.com:443 HTTP/1.0 C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.0 200 Connection established S C GET / HTTP/1.1 C Host: www.google.com C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.1 302 Found S Location: http://www.google.com S Date: Mon, 17 Mar 2008 10:52:08 GMT S Content-Type: text/html; charset=UTF-8 S Server: GFE/1.3 S Content-Length: 218 S Disconnected from www.google.com Connecting to www.google.com Connecting to HTTP proxy server IP 85.186.159.233 port 8080... Connected to 85.186.159.233 C CONNECT www.google.com:443 HTTP/1.0 C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.0 200 Connection established S C GET / HTTP/1.1 C Host: www.google.com C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.1 302 Found S Location: http://www.google.com S Date: Mon, 17 Mar 2008 10:52:12 GMT S Content-Type: text/html; charset=UTF-8 S Server: GFE/1.3 S Content-Length: 218 S Disconnected from www.google.com Connecting to www.google.com Connecting to HTTP proxy server IP 85.186.159.233 port 8080... Connected to 85.186.159.233 C CONNECT www.google.com:443 HTTP/1.0 C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.0 200 Connection established S C GET / HTTP/1.1 C Host: www.google.com C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.1 302 Found S Location: http://www.google.com S Date: Mon, 17 Mar 2008 10:52:17 GMT S Content-Type: text/html; charset=UTF-8 S Server: GFE/1.3 S Content-Length: 218 S Disconnected from www.google.com Connecting to www.google.com Connecting to HTTP proxy server IP 85.186.159.233 port 8080... Connected to 85.186.159.233 C CONNECT www.google.com:443 HTTP/1.0 C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.0 200 Connection established S C GET / HTTP/1.1 C Host: www.google.com C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.1 302 Found S Location: http://www.google.com S Date: Mon, 17 Mar 2008 10:52:21 GMT S Content-Type: text/html; charset=UTF-8 S Server: GFE/1.3 S Content-Length: 218 S Disconnected from www.google.com Connecting to www.google.com Connecting to HTTP proxy server IP 85.186.159.233 port 8080... Connected to 85.186.159.233 C CONNECT www.google.com:443 HTTP/1.0 C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C S HTTP/1.0 200 Connection established S C GET / HTTP/1.1 C Host: www.google.com C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) C Disconnected from www.google.com Error: it was exceeded the limit of request redirections
Yes, there was indeed a bug that was preventing to access SSL sites via proxies correctly.
I just uploaded a fixed version. You may try it now. Thank you for reporting. |
info at phpclasses dot org.
