diff options
author | Waweic <waweic@activ.ism.rocks> | 2020-11-18 15:27:10 +0100 |
---|---|---|
committer | Waweic <waweic@activ.ism.rocks> | 2020-11-18 15:27:10 +0100 |
commit | a97a2de9b95bd7e677c4831c6b6ddaef50bfa913 (patch) | |
tree | 65ab2498ac635489be3a57ff3f773ecce20609eb | |
parent | bd3262d5febad0409a875f1eda30b7d1150c9ac8 (diff) |
Add username and ipv6 literals to authority regex
-rw-r--r-- | src/gmutil.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gmutil.c b/src/gmutil.c index 04621e54..691260dc 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -41,7 +41,9 @@ void init_Url(iUrl *d, const iString *text) { | |||
41 | urlPattern_ = new_RegExp("^(([^:/?#]+):)?(//([^/?#]*))?" | 41 | urlPattern_ = new_RegExp("^(([^:/?#]+):)?(//([^/?#]*))?" |
42 | "([^?#]*)(\\?([^#]*))?(#(.*))?", | 42 | "([^?#]*)(\\?([^#]*))?(#(.*))?", |
43 | caseInsensitive_RegExpOption); | 43 | caseInsensitive_RegExpOption); |
44 | authPattern_ = new_RegExp("([^:]+)(:([0-9]+))?", caseInsensitive_RegExpOption); | 44 | authPattern_ = new_RegExp("(([^@]+)@)?(([^:\\[\\]]+)" |
45 | "|(\\[[0-9a-f:]+\\]))(:([0-9]+))?", | ||
46 | caseInsensitive_RegExpOption); | ||
45 | } | 47 | } |
46 | iZap(*d); | 48 | iZap(*d); |
47 | iRegExpMatch m; | 49 | iRegExpMatch m; |
@@ -55,8 +57,8 @@ void init_Url(iUrl *d, const iString *text) { | |||
55 | /* Check if the authority contains a port. */ | 57 | /* Check if the authority contains a port. */ |
56 | init_RegExpMatch(&m); | 58 | init_RegExpMatch(&m); |
57 | if (matchRange_RegExp(authPattern_, d->host, &m)) { | 59 | if (matchRange_RegExp(authPattern_, d->host, &m)) { |
58 | d->host = capturedRange_RegExpMatch(&m, 1); | 60 | d->host = capturedRange_RegExpMatch(&m, 3); |
59 | d->port = capturedRange_RegExpMatch(&m, 3); | 61 | d->port = capturedRange_RegExpMatch(&m, 7); |
60 | } | 62 | } |
61 | } | 63 | } |
62 | } | 64 | } |