|
@@ 867-884 (lines=18) @@
|
| 864 |
|
break; |
| 865 |
|
|
| 866 |
|
// if a header begins with Location: or URI:, set the redirect |
| 867 |
|
if(preg_match("/^(Location:|URI:)/i",$currentHeader)) |
| 868 |
|
{ |
| 869 |
|
// get URL portion of the redirect |
| 870 |
|
preg_match("/^(Location:|URI:)[ ]+(.*)/i",chop($currentHeader),$matches); |
| 871 |
|
// look for :// in the Location header to see if hostname is included |
| 872 |
|
if(!preg_match("|\:\/\/|",$matches[2])) |
| 873 |
|
{ |
| 874 |
|
// no host in the path, so prepend |
| 875 |
|
$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
| 876 |
|
// eliminate double slash |
| 877 |
|
if(!preg_match("|^/|",$matches[2])) |
| 878 |
|
$this->_redirectaddr .= "/".$matches[2]; |
| 879 |
|
else |
| 880 |
|
$this->_redirectaddr .= $matches[2]; |
| 881 |
|
} |
| 882 |
|
else |
| 883 |
|
$this->_redirectaddr = $matches[2]; |
| 884 |
|
} |
| 885 |
|
|
| 886 |
|
if(preg_match("|^HTTP/|",$currentHeader)) |
| 887 |
|
{ |
|
@@ 1038-1055 (lines=18) @@
|
| 1035 |
|
{ |
| 1036 |
|
|
| 1037 |
|
// if a header begins with Location: or URI:, set the redirect |
| 1038 |
|
if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) |
| 1039 |
|
{ |
| 1040 |
|
// get URL portion of the redirect |
| 1041 |
|
preg_match("/^(Location: |URI:)\s+(.*)/",chop($result_headers[$currentHeader]),$matches); |
| 1042 |
|
// look for :// in the Location header to see if hostname is included |
| 1043 |
|
if(!preg_match("|\:\/\/|",$matches[2])) |
| 1044 |
|
{ |
| 1045 |
|
// no host in the path, so prepend |
| 1046 |
|
$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
| 1047 |
|
// eliminate double slash |
| 1048 |
|
if(!preg_match("|^/|",$matches[2])) |
| 1049 |
|
$this->_redirectaddr .= "/".$matches[2]; |
| 1050 |
|
else |
| 1051 |
|
$this->_redirectaddr .= $matches[2]; |
| 1052 |
|
} |
| 1053 |
|
else |
| 1054 |
|
$this->_redirectaddr = $matches[2]; |
| 1055 |
|
} |
| 1056 |
|
|
| 1057 |
|
if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) |
| 1058 |
|
$this->response_code = $result_headers[$currentHeader]; |