mirror of https://github.com/axmolengine/axmol.git
Fix http request issue when path empty from url
Ensure path can be use for http request directly
This commit is contained in:
parent
28eb9e1886
commit
427ae694bd
|
@ -174,7 +174,7 @@ bool Uri::doParse(std::string_view str)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasScheme = true;
|
bool hasScheme = true;
|
||||||
;
|
|
||||||
std::string copied(str);
|
std::string copied(str);
|
||||||
if (copied.find("://") == std::string::npos)
|
if (copied.find("://") == std::string::npos)
|
||||||
{
|
{
|
||||||
|
@ -258,6 +258,10 @@ bool Uri::doParse(std::string_view str)
|
||||||
_authority.append(::toString(getPort()));
|
_authority.append(::toString(getPort()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure path can be use for http request directly
|
||||||
|
if (_path.empty())
|
||||||
|
_path.push_back('/');
|
||||||
|
|
||||||
// Assign path etc part
|
// Assign path etc part
|
||||||
_pathEtc = _path;
|
_pathEtc = _path;
|
||||||
if (!_query.empty())
|
if (!_query.empty())
|
||||||
|
@ -314,9 +318,6 @@ bool Uri::doParse(std::string_view str)
|
||||||
else
|
else
|
||||||
_isCustomPort = _port != 0;
|
_isCustomPort = _port != 0;
|
||||||
|
|
||||||
if (_path.empty())
|
|
||||||
_path.push_back('/');
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue