diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2018-07-01 23:36:38 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2018-07-01 23:36:38 -0700 |
commit | b6728bb7151b3b72cbd6787e3a9d9d581c6e741c (patch) | |
tree | 41465ddd69d8e7bf97aaa492c4e9a7ae62c482d5 /src/Uri.cpp | |
parent | 432a413f585c834d7ecd69a46443a33af40f79db (diff) |
Normalize scheme and reg-name elements to lower case
Diffstat (limited to 'src/Uri.cpp')
-rw-r--r-- | src/Uri.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Uri.cpp b/src/Uri.cpp index b30796c..08304d3 100644 --- a/src/Uri.cpp +++ b/src/Uri.cpp @@ -7,6 +7,7 @@ */ #include "IsCharacterInSet.hpp" +#include "NormalizeCaseInsensitiveString.hpp" #include "PercentEncodedCharacterDecoder.hpp" #include <functional> @@ -467,6 +468,7 @@ namespace Uri { int decodedCharacter = 0; host.clear(); PercentEncodedCharacterDecoder pecDecoder; + bool hostIsRegName = false; for (const auto c: hostPortString) { switch(decoderState) { case 0: { // first character @@ -476,6 +478,7 @@ namespace Uri { break; } else { decoderState = 1; + hostIsRegName = true; } } @@ -555,6 +558,9 @@ namespace Uri { } break; } } + if (hostIsRegName) { + host = NormalizeCaseInsensitiveString(host); + } if (portString.empty()) { hasPort = false; } else { @@ -600,6 +606,7 @@ namespace Uri { ) { return false; } + impl_->scheme = NormalizeCaseInsensitiveString(impl_->scheme); rest = uriString.substr(schemeEnd + 1); } |