summaryrefslogtreecommitdiffstats
path: root/Auth
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2008-06-11 18:20:36 +0000
committertailor <cygnus@janrain.com>2008-06-11 18:20:36 +0000
commit0ef9be71c1ff6114d04bc93d5156c00b25653a1b (patch)
tree5475341b23b50af02be47b47c06172b70350becf /Auth
parent1f87ced037c0ec00829dc62ee62bd1df28ee2fb5 (diff)
downloadphp-openid-0ef9be71c1ff6114d04bc93d5156c00b25653a1b.zip
php-openid-0ef9be71c1ff6114d04bc93d5156c00b25653a1b.tar.gz
php-openid-0ef9be71c1ff6114d04bc93d5156c00b25653a1b.tar.bz2
[project @ Auth_OpenID_urinorm: fail to parse URIs with non-ASCII characters]
Diffstat (limited to 'Auth')
-rw-r--r--Auth/OpenID/URINorm.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/Auth/OpenID/URINorm.php b/Auth/OpenID/URINorm.php
index 8c0ede9..f821d83 100644
--- a/Auth/OpenID/URINorm.php
+++ b/Auth/OpenID/URINorm.php
@@ -27,6 +27,17 @@ function Auth_OpenID_getEncodedPattern()
return '/%([0-9A-Fa-f]{2})/';
}
+# gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+#
+# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+# / "*" / "+" / "," / ";" / "="
+#
+# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+function Auth_OpenID_getURLIllegalCharRE()
+{
+ return "/([^-A-Za-z0-9:\/\?#\[\]@\!\$&'\(\)\*\+,;=\._~\%])/";
+}
+
function Auth_OpenID_getUnreserved()
{
$_unreserved = array();
@@ -139,6 +150,13 @@ function Auth_OpenID_urinorm($uri)
}
}
+ $illegal_matches = array();
+ preg_match(Auth_OpenID_getURLIllegalCharRE(),
+ $uri, $illegal_matches);
+ if ($illegal_matches) {
+ return null;
+ }
+
$scheme = $uri_matches[2];
if ($scheme) {
$scheme = strtolower($scheme);