diff options
author | Philip Whitfield <underdoeg@users.noreply.github.com> | 2021-06-11 10:09:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-11 10:09:05 +0200 |
commit | 3d9f29910ce6d317f70b2d4e7cacea2d33f28bb1 (patch) | |
tree | ddd9c1669b1d005152f4932f3895cec1f0d404c3 | |
parent | 7e1a6befdaf6c6f8627bc6ef6621666b6024cf91 (diff) |
fix url parsing with port numbers
String.get_slice_count is always at least 1 or 2 for bases with a port number.
Before this change the following URL would return ERR_INVALID_PARAMETER ```ws://127.0.0.1:8000/test```
-rw-r--r-- | core/string/ustring.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 49cf171f2b..31249ce0ff 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -275,7 +275,7 @@ Error String::parse_url(String &r_scheme, String &r_host, int &r_port, String &r base = base.substr(pos + 1, base.length() - pos - 1); } else { // Anything else - if (base.get_slice_count(":") > 1) { + if (base.get_slice_count(":") > 2) { return ERR_INVALID_PARAMETER; } pos = base.rfind(":"); |