blob: cf6ecdb01e0ad8a7df3f024c5786eb52d1d06db2 [file] [log] [blame]
Syntax based normalization of URI's
This normalizes URI's based on the specification RFC 3986
Example usage:
require_once 'URLNormalizer.php';
$url = 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d';
$un = new URLNormalizer();
$un->setUrl( $url );
echo $un->normalize();
// result: "example://a/b/c/%7Bfoo%7D"
The normalization process preserves semantics so, for example, the following URL's are all equivalent:
HTTP:// and and and and and and
The following normalizations are performed:
1. Converting the scheme and host to lower case
2. Capitalizing letters in escape sequences
3. Decoding percent-encoded octets of unreserved characters
4. Adding trailing /
5. Removing the default port
6. Removing dot-segments
For more information about these normalizations, please see the following Wikipedia article:
Add further scheme-based normalization steps, as detailed in section 6.2.3 of the RFC.