mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-09-01 17:58:29 +00:00
return false instead of throwing on a url with nothing after the schema
This commit is contained in:
@@ -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