diff options
author | tailor <cygnus@janrain.com> | 2008-06-11 18:20:36 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2008-06-11 18:20:36 +0000 |
commit | 0ef9be71c1ff6114d04bc93d5156c00b25653a1b (patch) | |
tree | 5475341b23b50af02be47b47c06172b70350becf /Auth | |
parent | 1f87ced037c0ec00829dc62ee62bd1df28ee2fb5 (diff) | |
download | php-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.php | 18 |
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); |