diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-24 09:45:36 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-24 09:45:36 +0300 |
commit | fbf36dfbf77701d647f0133f1532ebc42eb05e32 (patch) | |
tree | 6d32e92db2d4d9222fe58390669de90a482f71a5 | |
parent | 1064d21387d7c9e1b8468c63a24667a50894e465 (diff) |
Initialize RegExpMatches
-rw-r--r-- | src/gmcerts.c | 1 | ||||
-rw-r--r-- | src/gmdocument.c | 1 | ||||
-rw-r--r-- | src/gmrequest.c | 12 | ||||
-rw-r--r-- | src/gmutil.c | 1 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 1 | ||||
-rw-r--r-- | src/ui/text.c | 1 |
6 files changed, 17 insertions, 0 deletions
diff --git a/src/gmcerts.c b/src/gmcerts.c index 2600b4cf..b8fb6a7f 100644 --- a/src/gmcerts.c +++ b/src/gmcerts.c | |||
@@ -266,6 +266,7 @@ static void load_GmCerts_(iGmCerts *d) { | |||
266 | iRangecc line = iNullRange; | 266 | iRangecc line = iNullRange; |
267 | while (nextSplit_Rangecc(&src, "\n", &line)) { | 267 | while (nextSplit_Rangecc(&src, "\n", &line)) { |
268 | iRegExpMatch m; | 268 | iRegExpMatch m; |
269 | init_RegExpMatch(&m); | ||
269 | if (matchRange_RegExp(pattern, line, &m)) { | 270 | if (matchRange_RegExp(pattern, line, &m)) { |
270 | const iRangecc domain = capturedRange_RegExpMatch(&m, 1); | 271 | const iRangecc domain = capturedRange_RegExpMatch(&m, 1); |
271 | const iRangecc until = capturedRange_RegExpMatch(&m, 2); | 272 | const iRangecc until = capturedRange_RegExpMatch(&m, 2); |
diff --git a/src/gmdocument.c b/src/gmdocument.c index 89d567b0..5bc16fda 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -197,6 +197,7 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li | |||
197 | pattern_ = new_RegExp("=>\\s*([^\\s]+)(\\s.*)?", caseInsensitive_RegExpOption); | 197 | pattern_ = new_RegExp("=>\\s*([^\\s]+)(\\s.*)?", caseInsensitive_RegExpOption); |
198 | } | 198 | } |
199 | iRegExpMatch m; | 199 | iRegExpMatch m; |
200 | init_RegExpMatch(&m); | ||
200 | if (matchRange_RegExp(pattern_, line, &m)) { | 201 | if (matchRange_RegExp(pattern_, line, &m)) { |
201 | iGmLink *link = new_GmLink(); | 202 | iGmLink *link = new_GmLink(); |
202 | setRange_String(&link->url, capturedRange_RegExpMatch(&m, 1)); | 203 | setRange_String(&link->url, capturedRange_RegExpMatch(&m, 1)); |
diff --git a/src/gmrequest.c b/src/gmrequest.c index 6ea4aa50..c231e1f3 100644 --- a/src/gmrequest.c +++ b/src/gmrequest.c | |||
@@ -199,6 +199,17 @@ static void checkServerCertificate_GmRequest_(iGmRequest *d) { | |||
199 | if (!isExpired_TlsCertificate(cert)) { | 199 | if (!isExpired_TlsCertificate(cert)) { |
200 | d->resp.certFlags |= timeVerified_GmCertFlag; | 200 | d->resp.certFlags |= timeVerified_GmCertFlag; |
201 | } | 201 | } |
202 | /* TODO: Check for IP too (see below), because it may be specified in the SAN. */ | ||
203 | #if 0 | ||
204 | iString *ip = toStringFlags_Address(address_TlsRequest(d->req), noPort_SocketStringFlag, 0); | ||
205 | if (verifyIp_TlsCertificate(cert, ip)) { | ||
206 | printf("[GmRequest] IP address %s matches!\n", cstr_String(ip)); | ||
207 | } | ||
208 | else { | ||
209 | printf("[GmRequest] IP address %s not matched\n", cstr_String(ip)); | ||
210 | } | ||
211 | delete_String(ip); | ||
212 | #endif | ||
202 | if (verifyDomain_TlsCertificate(cert, domain)) { | 213 | if (verifyDomain_TlsCertificate(cert, domain)) { |
203 | d->resp.certFlags |= domainVerified_GmCertFlag; | 214 | d->resp.certFlags |= domainVerified_GmCertFlag; |
204 | } | 215 | } |
@@ -303,6 +314,7 @@ static const iBlock *aboutPageSource_(iRangecc path) { | |||
303 | static const iBlock *replaceVariables_(const iBlock *block) { | 314 | static const iBlock *replaceVariables_(const iBlock *block) { |
304 | iRegExp *var = new_RegExp("\\$\\{([^}]+)\\}", 0); | 315 | iRegExp *var = new_RegExp("\\$\\{([^}]+)\\}", 0); |
305 | iRegExpMatch m; | 316 | iRegExpMatch m; |
317 | init_RegExpMatch(&m); | ||
306 | if (matchRange_RegExp(var, range_Block(block), &m)) { | 318 | if (matchRange_RegExp(var, range_Block(block), &m)) { |
307 | iBlock *replaced = collect_Block(copy_Block(block)); | 319 | iBlock *replaced = collect_Block(copy_Block(block)); |
308 | do { | 320 | do { |
diff --git a/src/gmutil.c b/src/gmutil.c index cd00eb1d..2927953d 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -34,6 +34,7 @@ void init_Url(iUrl *d, const iString *text) { | |||
34 | caseInsensitive_RegExpOption); | 34 | caseInsensitive_RegExpOption); |
35 | } | 35 | } |
36 | iRegExpMatch m; | 36 | iRegExpMatch m; |
37 | init_RegExpMatch(&m); | ||
37 | if (matchString_RegExp(absoluteUrlPattern_, text, &m)) { | 38 | if (matchString_RegExp(absoluteUrlPattern_, text, &m)) { |
38 | d->protocol = capturedRange_RegExpMatch(&m, 1); | 39 | d->protocol = capturedRange_RegExpMatch(&m, 1); |
39 | d->host = capturedRange_RegExpMatch(&m, 2); | 40 | d->host = capturedRange_RegExpMatch(&m, 2); |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 9f4708e7..6c0337a0 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -656,6 +656,7 @@ static void parseUser_DocumentWidget_(iDocumentWidget *d) { | |||
656 | iRegExp *userPats[2] = { new_RegExp("~([^/?]+)", 0), | 656 | iRegExp *userPats[2] = { new_RegExp("~([^/?]+)", 0), |
657 | new_RegExp("/users/([^/?]+)", caseInsensitive_RegExpOption) }; | 657 | new_RegExp("/users/([^/?]+)", caseInsensitive_RegExpOption) }; |
658 | iRegExpMatch m; | 658 | iRegExpMatch m; |
659 | init_RegExpMatch(&m); | ||
659 | iForIndices(i, userPats) { | 660 | iForIndices(i, userPats) { |
660 | if (matchString_RegExp(userPats[i], d->mod.url, &m)) { | 661 | if (matchString_RegExp(userPats[i], d->mod.url, &m)) { |
661 | setRange_String(d->titleUser, capturedRange_RegExpMatch(&m, 1)); | 662 | setRange_String(d->titleUser, capturedRange_RegExpMatch(&m, 1)); |
diff --git a/src/ui/text.c b/src/ui/text.c index 40956e29..a4a3804d 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -434,6 +434,7 @@ static iRect run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLe | |||
434 | /* ANSI escape. */ | 434 | /* ANSI escape. */ |
435 | chPos++; | 435 | chPos++; |
436 | iRegExpMatch m; | 436 | iRegExpMatch m; |
437 | init_RegExpMatch(&m); | ||
437 | if (match_RegExp(text_.ansiEscape, chPos, text.end - chPos, &m)) { | 438 | if (match_RegExp(text_.ansiEscape, chPos, text.end - chPos, &m)) { |
438 | if (mode == draw_RunMode) { | 439 | if (mode == draw_RunMode) { |
439 | /* Change the color. */ | 440 | /* Change the color. */ |