mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-22 10:42:29 +00:00
return false instead of throwing on a url with nothing after the schema
This commit is contained in:
1 parent
954e98eb4d
commit
039d3feea7
2 files changed
+7
No files matched your search
@@ -133,6 +133,7 @@ namespace http
|
||||
}
|
||||
|
||||
/* hostname[:port][/path] */
|
||||
if (pos_p >= url.length ()) return false; /* nothing left after schema or user part */
|
||||
if (url.at(pos_p) == '[') // ipv6
|
||||
{
|
||||
auto pos_b = url.find(']', pos_p);
|
||||
|
||||
@@ -125,6 +125,12 @@ int main() {
|
||||
assert(url->frag == "frag");
|
||||
delete url;
|
||||
|
||||
/* nothing after the schema or the user part: must not throw */
|
||||
url = new URL;
|
||||
assert(url->parse("http://") == false);
|
||||
assert(url->parse("http://user@") == false);
|
||||
delete url;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user