From: Kevin Day Date: Wed, 26 Apr 2017 16:01:29 +0000 (-0500) Subject: Bugfix: uri processing code is not handling authority correctly X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=79884f0ac99d3fb4a2e154cb5227a72bfd8c4a73;p=koopa 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. --- 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) {