|
@@ 495-512 (lines=18) @@
|
| 492 |
|
break; |
| 493 |
|
|
| 494 |
|
// if a header begins with Location: or URI:, set the redirect |
| 495 |
|
if(preg_match("/^(Location:|URI:)/i",$currentHeader)) |
| 496 |
|
{ |
| 497 |
|
// get URL portion of the redirect |
| 498 |
|
preg_match("/^(Location:|URI:)\s+(.*)/",chop($currentHeader),$matches); |
| 499 |
|
// look for :// in the Location header to see if hostname is included |
| 500 |
|
if(!preg_match("|\:\/\/|",$matches[2])) |
| 501 |
|
{ |
| 502 |
|
// no host in the path, so prepend |
| 503 |
|
$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
| 504 |
|
// eliminate double slash |
| 505 |
|
if(!preg_match("|^/|",$matches[2])) |
| 506 |
|
$this->_redirectaddr .= "/".$matches[2]; |
| 507 |
|
else |
| 508 |
|
$this->_redirectaddr .= $matches[2]; |
| 509 |
|
} |
| 510 |
|
else |
| 511 |
|
$this->_redirectaddr = $matches[2]; |
| 512 |
|
} |
| 513 |
|
|
| 514 |
|
if(preg_match("|^HTTP/|",$currentHeader)) |
| 515 |
|
{ |
|
@@ 674-691 (lines=18) @@
|
| 671 |
|
{ |
| 672 |
|
|
| 673 |
|
// if a header begins with Location: or URI:, set the redirect |
| 674 |
|
if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader])) |
| 675 |
|
{ |
| 676 |
|
// get URL portion of the redirect |
| 677 |
|
preg_match("/^(Location: |URI:)(.*)/",chop($result_headers[$currentHeader]),$matches); |
| 678 |
|
// look for :// in the Location header to see if hostname is included |
| 679 |
|
if(!preg_match("|\:\/\/|",$matches[2])) |
| 680 |
|
{ |
| 681 |
|
// no host in the path, so prepend |
| 682 |
|
$this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port; |
| 683 |
|
// eliminate double slash |
| 684 |
|
if(!preg_match("|^/|",$matches[2])) |
| 685 |
|
$this->_redirectaddr .= "/".$matches[2]; |
| 686 |
|
else |
| 687 |
|
$this->_redirectaddr .= $matches[2]; |
| 688 |
|
} |
| 689 |
|
else |
| 690 |
|
$this->_redirectaddr = $matches[2]; |
| 691 |
|
} |
| 692 |
|
|
| 693 |
|
if(preg_match("|^HTTP/|",$result_headers[$currentHeader])) |
| 694 |
|
{ |