mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
commit
d042b62bed
@ -149,9 +149,13 @@ Url Url::Parser::parseUrl(oatpp::parser::Caret& caret) {
|
||||
Url result;
|
||||
|
||||
if(caret.findChar(':')) {
|
||||
caret.setPosition(0);
|
||||
result.scheme = parseScheme(caret);
|
||||
caret.canContinueAtChar(':', 1);
|
||||
if(caret.canContinueAtChar(':', 1) && !caret.isAtText("//", 2, true)) {
|
||||
caret.setPosition(0);
|
||||
} else {
|
||||
caret.setPosition(0);
|
||||
result.scheme = parseScheme(caret);
|
||||
caret.canContinueAtChar(':', 1);
|
||||
}
|
||||
} else {
|
||||
caret.setPosition(0);
|
||||
}
|
||||
|
@ -118,6 +118,19 @@ void UrlTest::onRun() {
|
||||
OATPP_ASSERT(url.queryParams.getSize() == 0)
|
||||
}
|
||||
|
||||
{
|
||||
const char* urlText = "oatpp.io:8000/path";
|
||||
OATPP_LOGV(TAG, "urlText='%s'", urlText)
|
||||
auto url = Url::Parser::parseUrl(urlText);
|
||||
|
||||
OATPP_ASSERT(url.scheme == nullptr)
|
||||
OATPP_ASSERT(url.authority.userInfo == nullptr)
|
||||
OATPP_ASSERT(url.authority.host && url.authority.host == "oatpp.io")
|
||||
OATPP_ASSERT(url.authority.port == 8000)
|
||||
OATPP_ASSERT(url.path == "/path")
|
||||
OATPP_ASSERT(url.queryParams.getSize() == 0)
|
||||
}
|
||||
|
||||
{
|
||||
const char* urlText = "?key1=value1&key2=value2&key3=value3";
|
||||
OATPP_LOGV(TAG, "urlText='%s'", urlText)
|
||||
|
Loading…
Reference in New Issue
Block a user