
Thomas Gottfried - 2007-02-08 07:29:07
Hi,
I have a problem with my companies proxy-server when sending https message using HTTP Protocol Client. http messages working fine with this proxy. And https on leased line works a well (without proxy)
Proxy Server refuses to process message with error 400 "invalid Request":
This is output of test_http-script:
******************************************************************
# Opening connection to:
www.unterhaus-mainz.de
Connecting to www.unterhaus-mainz.de
Connecting to HTTP server IP 194.39.156.96...
Connected to 194.39.156.96
# Sending request for page:
/system_check.html
C GET https://www.unterhaus-mainz.de/system_check.html HTTP/1.1
C Host: www.unterhaus-mainz.de
C User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
C Pragma: nocache
C
# Request:
GET https://www.unterhaus-mainz.de/system_check.html HTTP/1.1
# Request headers:
Host: www.unterhaus-mainz.de
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Pragma: nocache
S HTTP/1.1 400 Bad Request
S Cache-Control: no-cache
S Pragma: no-cache
S Content-Type: text/html; charset=utf-8
S Proxy-Connection: close
S Connection: close
S Content-Length: 708
S
# Response status code:
400
# Response headers:
http/1.1 400 bad request:
cache-control: no-cache
pragma: no-cache
content-type: text/html; charset=utf-8
proxy-connection: close
connection: close
content-length: 708
******************************************************************
I'm pretty sure that proxy works with https messages as browser-messages are working fine. I've also managed to connect server through proxy using another piece of code - what is unfortuately not SSL coded:
******************************************************************
$host = "www.unterhaus-mainz.de:443";
$path = "/system_check.html";
$proxy = "194.39.156.96";
$proxy_port = "8080";
$fp = fsockopen($proxy, $proxy_port, $errno, $errstr);
fputs($fp, "POST ssl://$host$path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Referer: $referer\r\n");
fputs($fp, "Content-type: text/xml; charset=UTF8\r\n");
fputs($fp, "Cache-Control: no-cache\r\n");
fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data_to_send);
while(!feof($fp)) {
$res .= fgets($fp, 128);
}
fclose($fp);
******************************************************************
Could somebody help me?
It's really strange. Looks a little bit like proxy configuration is not fully http-complient ... or httpClient isn't.
thankx a lot in advance
thomas