Commit 45c0025c authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Tomaz Canabrava
Browse files

URI regexp: allow / as path

Allow a single slash as path component of a URI.

Test:
https://example.com/?query=value
parent 1af5cfc2
......@@ -60,17 +60,17 @@ void HotSpotFilterTest::testUrlFilterRegex_data()
<< "https://example.com/foo,bar" << true;
QTest::newRow("empty_query") << "http://example.com/?"
<< "http://example.com" << true;
<< "http://example.com/" << true;
QTest::newRow("empty_fragment") << "http://example.com/#"
<< "http://example.com" << true;
<< "http://example.com/" << true;
QTest::newRow("www_followed_by_colon") << "www.example.com:foo@bar.com"
<< "www.example.com" << true;
QTest::newRow("ipv6") << "http://[2a00:1450:4001:829::200e]/"
<< "http://[2a00:1450:4001:829::200e]" << true;
<< "http://[2a00:1450:4001:829::200e]/" << true;
QTest::newRow("ipv6_with_port") << "http://[2a00:1450:4001:829::200e]:80/"
<< "http://[2a00:1450:4001:829::200e]:80" << true;
<< "http://[2a00:1450:4001:829::200e]:80/" << true;
}
void HotSpotFilterTest::testUrlFilterRegex()
......
......@@ -51,7 +51,7 @@ static const char host[] = "(?:[" COMMON_1 "]++|" IPv6_literal ")?+"; // www.foo
static const char port[] = "(?::[0-9]+)?+"; // :1234
#define COMMON_2 "a-z0-9\\-._~%!$&'()*+,;=:@/"
static const char path[] = "(?:/[" COMMON_2 "]+)?+"; // /path/to/some/place
static const char path[] = "(?:/[" COMMON_2 "]*+)?+"; // /path/to/some/place
static const char query[] = "(?:\\?[" COMMON_2 "]+)?+"; // "?somequery=bar"
static const char fragment[] = "(?:#[" COMMON_2 "]+)?+"; // "#fragment"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment