aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2018-07-01 14:45:45 -0700
committerRichard Walters <rwalters@digitalstirling.com>2018-07-01 14:45:45 -0700
commit6b9217cc7eeb72363f33a0b1330dcdca52d25f8e (patch)
treeed278cad505a5b57546ff59b03c947bc336e9468 /src
parent6c79c19334b53560ea9d2036da279994b8f83be4 (diff)
Fix bug in parsing scheme
A colon may be in the authority, if present, so limit the search for scheme delimiter so we aren't scanning the authority part, when parsing the scheme.
Diffstat (limited to 'src')
-rw-r--r--src/Uri.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Uri.cpp b/src/Uri.cpp
index 1a82ee8..e218ecd 100644
--- a/src/Uri.cpp
+++ b/src/Uri.cpp
@@ -330,7 +330,11 @@ namespace Uri {
bool Uri::ParseFromString(const std::string& uriString) {
// First parse the scheme.
- const auto schemeEnd = uriString.find(':');
+ auto authorityDelimiter = uriString.find("//");
+ if (authorityDelimiter == std::string::npos) {
+ authorityDelimiter = uriString.length();
+ }
+ const auto schemeEnd = uriString.substr(0, authorityDelimiter).find(':');
std::string rest;
if (schemeEnd == std::string::npos) {
impl_->scheme.clear();