diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2018-07-01 15:45:06 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2018-07-01 15:45:06 -0700 |
commit | 0a991ade05f2e98b412301cb47cb6112a374ee8c (patch) | |
tree | e368412b5a960372468a00e7ce3cf4120dc7a616 | |
parent | 3b53550301363d9603a24ac8e9ec1b0e3fe2d11d (diff) |
Refactoring
Remove state 3 hole in host/port parsing state machine
-rw-r--r-- | src/Uri.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Uri.cpp b/src/Uri.cpp index de35f84..f122c0a 100644 --- a/src/Uri.cpp +++ b/src/Uri.cpp @@ -537,7 +537,7 @@ namespace Uri { case 0: { // first character if (c == '[') { host.push_back(c); - decoderState = 4; + decoderState = 3; break; } else { decoderState = 1; @@ -549,7 +549,7 @@ namespace Uri { pecDecoder = PercentEncodedCharacterDecoder(); decoderState = 2; } else if (c == ':') { - decoderState = 9; + decoderState = 8; } else { if ( IsCharacterInSet( @@ -586,38 +586,38 @@ namespace Uri { } } break; - case 4: { // IP-literal + case 3: { // IP-literal if (c == 'v') { host.push_back(c); - decoderState = 6; + decoderState = 5; break; } else { - decoderState = 5; + decoderState = 4; } } - case 5: { // IPv6Address + case 4: { // IPv6Address // TODO: research this offline first // before attempting to code it host.push_back(c); if (c == ']') { - decoderState = 8; + decoderState = 7; } } break; - case 6: { // IPvFuture: v ... + case 5: { // IPvFuture: v ... if (c == '.') { - decoderState = 7; + decoderState = 6; } else if (!IsCharacterInSet(c, {'0','9', 'A','F'})) { return false; } host.push_back(c); } break; - case 7: { // IPvFuture v 1*HEXDIG . ... + case 6: { // IPvFuture v 1*HEXDIG . ... host.push_back(c); if (c == ']') { - decoderState = 8; + decoderState = 7; } else if ( !IsCharacterInSet( c, @@ -640,16 +640,16 @@ namespace Uri { } } break; - case 8: { // illegal to have anything else, unless it's a colon, + case 7: { // illegal to have anything else, unless it's a colon, // in which case it's a port delimiter if (c == ':') { - decoderState = 9; + decoderState = 8; } else { return false; } } break; - case 9: { // port + case 8: { // port portString.push_back(c); } break; } |