Uri Parse improvements
diff --git a/include/rapidjson/uri.h b/include/rapidjson/uri.h
index 6353c32..7de7b80 100644
--- a/include/rapidjson/uri.h
+++ b/include/rapidjson/uri.h
@@ -295,24 +295,17 @@
         // Look for auth (//([^/?#]*))?
         auth_ = scheme_ + GetSchemeStringLength() + 1;
         *auth_ = '\0';
-        if (start < len) {
-            pos1 = start;
-            while (pos1 < len) {
-                if (uri[pos1] == '/' && uri[pos1 + 1] == '/') break;
-                pos1++;
+        if (start < len - 1 && uri[start] == '/' && uri[start + 1] == '/') {
+            pos2 = start + 2;
+            while (pos2 < len) {
+                if (uri[pos2] == '/') break;
+                if (uri[pos2] == '?') break;
+                if (uri[pos2] == '#') break;
+                pos2++;
             }
-            if (pos1 == start) {
-                pos2 = start + 2;
-                while (pos2 < len) {
-                    if (uri[pos2] == '/') break;
-                    if (uri[pos2] == '?') break;
-                    if (uri[pos2] == '#') break;
-                    pos2++;
-                }
-                std::memcpy(auth_, &uri[start], (pos2 - start) * sizeof(Ch));
-                auth_[pos2 - start] = '\0';
-                start = pos2;
-            }
+            std::memcpy(auth_, &uri[start], (pos2 - start) * sizeof(Ch));
+            auth_[pos2 - start] = '\0';
+            start = pos2;
         }
         // Look for path ([^?#]*)
         path_ = auth_ + GetAuthStringLength() + 1;
@@ -335,8 +328,8 @@
         // Look for query (\?([^#]*))?
         query_ = path_ + GetPathStringLength() + 1;
         *query_ = '\0';
-        if (start < len) {
-            pos2 = start;
+        if (start < len && uri[start] == '?') {
+            pos2 = start + 1;
             while (pos2 < len) {
                 if (uri[pos2] == '#') break;
                 pos2++;
@@ -350,7 +343,7 @@
         // Look for fragment (#(.*))?
         frag_ = query_ + GetQueryStringLength() + 1;
         *frag_ = '\0';
-        if (start < len) {
+        if (start < len && uri[start] == '#') {
             std::memcpy(frag_, &uri[start], (len - start) * sizeof(Ch));
             frag_[len - start] = '\0';
         }
diff --git a/test/unittest/uritest.cpp b/test/unittest/uritest.cpp
index 6cfa27d..5506aa1 100644
--- a/test/unittest/uritest.cpp
+++ b/test/unittest/uritest.cpp
@@ -160,6 +160,14 @@
     EXPECT_TRUE(u.GetBaseStringLength() == 0);
     EXPECT_TRUE(StrCmp(u.GetFragString(), "#frag/stuff") == 0);
     EXPECT_TRUE(u.GetFragStringLength() == len);
+
+    // Incomplete auth treated as path
+    str = "http:/";
+    const UriType u2 = UriType(str);
+    EXPECT_TRUE(StrCmp(u2.GetSchemeString(), "http:") == 0);
+    EXPECT_TRUE(u2.GetAuthStringLength() == 0);
+    EXPECT_TRUE(StrCmp(u2.GetPathString(), "/") == 0);
+    EXPECT_TRUE(StrCmp(u2.GetBaseString(), "http:/") == 0);
 }
 
 TEST(Uri, Parse_UTF16) {
@@ -274,6 +282,13 @@
     EXPECT_TRUE(u.GetBaseStringLength() == 0);
     EXPECT_TRUE(StrCmp(u.GetFragString(), L"#frag/stuff") == 0);
     EXPECT_TRUE(u.GetFragStringLength() == len);
+
+    // Incomplete auth treated as path
+    u = UriType(L"http:/");
+    EXPECT_TRUE(StrCmp(u.GetSchemeString(), L"http:") == 0);
+    EXPECT_TRUE(u.GetAuthStringLength() == 0);
+    EXPECT_TRUE(StrCmp(u.GetPathString(), L"/") == 0);
+    EXPECT_TRUE(StrCmp(u.GetBaseString(), L"http:/") == 0);
 }
 
 TEST(Uri, CopyConstructor) {