cvs: pear /HTTP HTTP.php

From: Date: Sun, 07 Apr 2002 22:56:22 +0000
Subject: cvs: pear /HTTP HTTP.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-3123@lists.php.net to get a copy of this message
richard Sun Apr 7 18:56:22 2002 EDT Modified files: /pear/HTTP HTTP.php Log: * Removed dependency on Net_URL Index: pear/HTTP/HTTP.php diff -u pear/HTTP/HTTP.php:1.11 pear/HTTP/HTTP.php:1.12 --- pear/HTTP/HTTP.php:1.11 Fri Apr 5 16:34:15 2002 +++ pear/HTTP/HTTP.php Sun Apr 7 18:56:22 2002 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: HTTP.php,v 1.11 2002/04/05 21:34:15 richard Exp $ +// $Id: HTTP.php,v 1.12 2002/04/07 22:56:22 richard Exp $ // // HTTP utility functions. // @@ -179,12 +179,21 @@ */ function redirect($url) { - if (!preg_match('/^(ht|f)tp:\/\//', $url)) { - require_once('Net/URL.php'); - $url = &new Net_URL($url); + global $HTTP_SERVER_VARS; + if (!preg_match('/^(ht|f)tps?:\/\//', $url)) { + $context = 'http' . (@$HTTP_SERVER_VARS['HTTPS'] == 'on' ? 's' : '') . '://' . $HTTP_SERVER_VARS['SERVER_NAME']; + if ($HTTP_SERVER_VARS['SERVER_PORT'] != 80) { + $context .= ':' . $HTTP_SERVER_VARS['SERVER_PORT']; + } + if ($url[0] != '/') { + $context .= dirname($HTTP_SERVER_VARS['PHP_SELF']); + $url = $context . '/' . preg_replace('!^\./!', '', $url); + } else { + $url = $context . $url; + } } - header('Location: ' . $url->getURL()); + header('Location: ' . $url); exit; } }

« previous php.pear.cvs (#3123) next »