summaryrefslogtreecommitdiff
path: root/src/gmutil.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-11-19 14:58:20 +0200
committerGitHub <noreply@github.com>2020-11-19 14:58:20 +0200
commitcb26852fb64510e4cdc8ccf96836b33e319d8da0 (patch)
tree365da7fd3875d8bf73c95b84849a0dcea6a55997 /src/gmutil.c
parentbceee4f414a59324b9b6724b7ffd69641af83810 (diff)
parenta97a2de9b95bd7e677c4831c6b6ddaef50bfa913 (diff)
Merge pull request #42 from waweic/dev
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}