From 79884f0ac99d3fb4a2e154cb5227a72bfd8c4a73 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 26 Apr 2017 11:01:29 -0500 Subject: [PATCH] Bugfix: uri processing code is not handling authority correctly The authority is now being processed after scheme is found in a url. The authority now properly returns success when a forward slash is found. --- common/base/classes/base_rfc_string.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/common/base/classes/base_rfc_string.php b/common/base/classes/base_rfc_string.php index 0c44f75..ee7fe22 100644 --- a/common/base/classes/base_rfc_string.php +++ b/common/base/classes/base_rfc_string.php @@ -3415,6 +3415,25 @@ abstract class c_base_rfc_string extends c_base_rfc_char { if ($code == c_base_ascii::SLASH_FORWARD) { unset($code); + // A second '/' should immediately follow the first to designate the authority. + if ($result['current'] + 1 < $stop) { + $result['current']++; + $code = $ordinals[$result['current']]; + + if ($code == c_base_ascii::SLASH_FORWARD) { + // begin processing authority. + $result['current']++; + + $this->p_rfc_string_is_uri_authority($ordinals, $characters, $stop, $result); + if ($result['invalid'] || $result['current'] >= $stop) { + return $result; + } + } + else { + $result['current']--; + } + } + // at this point it is known that this is a url instead of a urn. $this->p_rfc_string_is_uri_path($ordinals, $characters, $stop, $result); if ($result['invalid'] || $result['current'] >= $stop) { @@ -3756,7 +3775,11 @@ abstract class c_base_rfc_string extends c_base_rfc_char { $code = $ordinals[$result['current']]; - if ($code == c_base_ascii::PERCENT) { + if ($code == c_base_ascii::SLASH_FORWARD) { + // the slash designates the end of the authority. + break; + } + elseif ($code == c_base_ascii::PERCENT) { // valid only if two hex digits immediately follow. $result['current']++; if ($result['current'] >= $stop) { -- 1.8.3.1