|
@@ 795-809 (lines=15) @@
|
| 792 |
|
break; |
| 793 |
|
|
| 794 |
|
// if a header begins with Location: or URI:, set the redirect |
| 795 |
|
if (preg_match("/^(Location:|URI:)/i", $currentHeader)) { |
| 796 |
|
// get URL portion of the redirect |
| 797 |
|
preg_match("/^(Location:|URI:)[ ]+(.*)/i", chop($currentHeader), $matches); |
| 798 |
|
// look for :// in the Location header to see if hostname is included |
| 799 |
|
if (!preg_match("|\:\/\/|", $matches[2])) { |
| 800 |
|
// no host in the path, so prepend |
| 801 |
|
$this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port; |
| 802 |
|
// eliminate double slash |
| 803 |
|
if (!preg_match("|^/|", $matches[2])) |
| 804 |
|
$this->_redirectaddr .= "/" . $matches[2]; |
| 805 |
|
else |
| 806 |
|
$this->_redirectaddr .= $matches[2]; |
| 807 |
|
} else |
| 808 |
|
$this->_redirectaddr = $matches[2]; |
| 809 |
|
} |
| 810 |
|
|
| 811 |
|
if (preg_match("|^HTTP/|", $currentHeader)) { |
| 812 |
|
if (preg_match("|^HTTP/[^\s]*\s(.*?)\s|", $currentHeader, $status)) { |
|
@@ 960-974 (lines=15) @@
|
| 957 |
|
for ($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++) { |
| 958 |
|
|
| 959 |
|
// if a header begins with Location: or URI:, set the redirect |
| 960 |
|
if (preg_match("/^(Location: |URI: )/i", $result_headers[$currentHeader])) { |
| 961 |
|
// get URL portion of the redirect |
| 962 |
|
preg_match("/^(Location: |URI:)\s+(.*)/", chop($result_headers[$currentHeader]), $matches); |
| 963 |
|
// look for :// in the Location header to see if hostname is included |
| 964 |
|
if (!preg_match("|\:\/\/|", $matches[2])) { |
| 965 |
|
// no host in the path, so prepend |
| 966 |
|
$this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port; |
| 967 |
|
// eliminate double slash |
| 968 |
|
if (!preg_match("|^/|", $matches[2])) |
| 969 |
|
$this->_redirectaddr .= "/" . $matches[2]; |
| 970 |
|
else |
| 971 |
|
$this->_redirectaddr .= $matches[2]; |
| 972 |
|
} else |
| 973 |
|
$this->_redirectaddr = $matches[2]; |
| 974 |
|
} |
| 975 |
|
|
| 976 |
|
if (preg_match("|^HTTP/|", $result_headers[$currentHeader])) { |
| 977 |
|
$this->response_code = $result_headers[$currentHeader]; |