]> Kevux Git Server - koopa/commitdiff
Bugfix: uri processing code is not handling authority correctly
authorKevin Day <thekevinday@gmail.com>
Wed, 26 Apr 2017 16:01:29 +0000 (11:01 -0500)
committerKevin Day <thekevinday@gmail.com>
Wed, 26 Apr 2017 16:01:29 +0000 (11:01 -0500)
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

index 0c44f75b80a56a536f46ecb421487849d4307785..ee7fe222b72d4f1f2a5294fce19ad7ff930daa91 100644 (file)
@@ -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) {