if (firstColon > 0) {
return url().substr(0, firstColon);
}
-
+
return ""; // couldn't parse scheme
}
if (schemeEnd < 0) {
return ""; // couldn't parse scheme
}
-
+
int hostEnd = u.find('/', schemeEnd + 3);
if (hostEnd < 0) {
-// couldn't parse host, or URL looks like 'http://foo.com' (no trailing '/')
-// fixup to root resource path: '/'
- return "/";
+// couldn't parse host, or URL looks like 'http://foo.com' (no trailing '/')
+// fixup to root resource path: '/'
+ return "/";
}
-
+
int query = u.find('?', hostEnd + 1);
if (query < 0) {
// all remainder of URL is path
return u.substr(hostEnd);
}
-
+
return u.substr(hostEnd, query - hostEnd);
}
if (query < 0) {
return ""; //no query string found
}
-
+
return u.substr(query); //includes question mark
}