summaryrefslogtreecommitdiff
path: root/src/gmutil.c
diff options
context:
space:
mode:
authorWaweic <waweic@activ.ism.rocks>2020-11-18 15:27:10 +0100
committerWaweic <waweic@activ.ism.rocks>2020-11-18 15:27:10 +0100
commita97a2de9b95bd7e677c4831c6b6ddaef50bfa913 (patch)
tree65ab2498ac635489be3a57ff3f773ecce20609eb /src/gmutil.c
parentbd3262d5febad0409a875f1eda30b7d1150c9ac8 (diff)
Add username and ipv6 literals to authority regex
Diffstat (limited to 'src/gmutil.c')
-rw-r--r--src/gmutil.c8
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}