import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
* @package Zend_Uri
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Http.php 12041 2008-10-20 22:13:01Z shahar $
|
||||
* @version $Id: Http.php 14650 2009-04-05 03:15:38Z robinsk $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -48,7 +48,7 @@ class Zend_Uri_Http extends Zend_Uri
|
||||
const CHAR_RESERVED = ';\/?:@&=+$,';
|
||||
const CHAR_SEGMENT = ':@&=+$,;';
|
||||
const CHAR_UNWISE = '{}|\\\\^`';
|
||||
|
||||
|
||||
/**
|
||||
* HTTP username
|
||||
*
|
||||
@ -104,7 +104,7 @@ class Zend_Uri_Http extends Zend_Uri
|
||||
* @var array
|
||||
*/
|
||||
protected $_regex = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor accepts a string $scheme (e.g., http, https) and a scheme-specific part of the URI
|
||||
* (e.g., example.com/path/to/resource?query=param#fragment)
|
||||
@ -120,27 +120,27 @@ class Zend_Uri_Http extends Zend_Uri
|
||||
|
||||
// Set up grammar rules for validation via regular expressions. These
|
||||
// are to be used with slash-delimited regular expression strings.
|
||||
|
||||
// Escaped special characters (eg. '%25' for '%')
|
||||
|
||||
// Escaped special characters (eg. '%25' for '%')
|
||||
$this->_regex['escaped'] = '%[[:xdigit:]]{2}';
|
||||
|
||||
|
||||
// Unreserved characters
|
||||
$this->_regex['unreserved'] = '[' . self::CHAR_ALNUM . self::CHAR_MARK . ']';
|
||||
|
||||
|
||||
// Segment can use escaped, unreserved or a set of additional chars
|
||||
$this->_regex['segment'] = '(?:' . $this->_regex['escaped'] . '|[' .
|
||||
self::CHAR_ALNUM . self::CHAR_MARK . self::CHAR_SEGMENT . '])*';
|
||||
|
||||
|
||||
// Path can be a series of segmets char strings seperated by '/'
|
||||
$this->_regex['path'] = '(?:\/(?:' . $this->_regex['segment'] . ')?)+';
|
||||
|
||||
|
||||
// URI characters can be escaped, alphanumeric, mark or reserved chars
|
||||
$this->_regex['uric'] = '(?:' . $this->_regex['escaped'] . '|[' .
|
||||
self::CHAR_ALNUM . self::CHAR_MARK . self::CHAR_RESERVED .
|
||||
|
||||
$this->_regex['uric'] = '(?:' . $this->_regex['escaped'] . '|[' .
|
||||
self::CHAR_ALNUM . self::CHAR_MARK . self::CHAR_RESERVED .
|
||||
|
||||
// If unwise chars are allowed, add them to the URI chars class
|
||||
(self::$_config['allow_unwise'] ? self::CHAR_UNWISE : '') . '])';
|
||||
|
||||
|
||||
// If no scheme-specific part was supplied, the user intends to create
|
||||
// a new URI with this object. No further parsing is required.
|
||||
if (strlen($schemeSpecific) === 0) {
|
||||
@ -170,7 +170,8 @@ class Zend_Uri_Http extends Zend_Uri
|
||||
public static function fromString($uri)
|
||||
{
|
||||
if (is_string($uri) === false) {
|
||||
throw new InvalidArgumentException('$uri is not a string');
|
||||
require_once 'Zend/Uri/Exception.php';
|
||||
throw new Zend_Uri_Exception('$uri is not a string');
|
||||
}
|
||||
|
||||
$uri = explode(':', $uri, 2);
|
||||
@ -317,7 +318,7 @@ class Zend_Uri_Http extends Zend_Uri
|
||||
// Check the username against the allowed values
|
||||
$status = @preg_match('/^(?:' . $this->_regex['escaped'] . '|[' .
|
||||
self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $username);
|
||||
|
||||
|
||||
if ($status === false) {
|
||||
require_once 'Zend/Uri/Exception.php';
|
||||
throw new Zend_Uri_Exception('Internal error: username validation failed');
|
||||
@ -384,7 +385,7 @@ class Zend_Uri_Http extends Zend_Uri
|
||||
// Check the password against the allowed values
|
||||
$status = @preg_match('/^(?:' . $this->_regex['escaped'] . '|[' .
|
||||
self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $password);
|
||||
|
||||
|
||||
if ($status === false) {
|
||||
require_once 'Zend/Uri/Exception.php';
|
||||
throw new Zend_Uri_Exception('Internal error: password validation failed.');
|
||||
|
Reference in New Issue
Block a user