From: Vsevolod Stakhov Date: Thu, 19 Feb 2015 16:34:03 +0000 (+0000) Subject: Improve some cases of IDN urls. X-Git-Tag: 0.8.2~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47c75ed18d3e28f39619ba7c919890d48940a9e4;p=thirdparty%2Frspamd.git Improve some cases of IDN urls. --- diff --git a/src/libserver/url.c b/src/libserver/url.c index d52138f8fe..af52d5e527 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -1037,6 +1037,7 @@ rspamd_web_parse (struct http_parser_url *u, const gchar *str) } else { st = parse_port; + c = p + 1; } p ++; } @@ -1497,21 +1498,20 @@ url_web_end (const gchar *begin, /* find the end of the domain */ if (is_atom (*p)) { - /* might be a domain or user@domain */ c = p; while (p < end) { - if (!is_atom (*p)) { + if (!is_atom (*p) && !(*p & 0x80)) { break; } p++; - while (p < end && is_atom (*p)) { + while (p < end && (is_atom (*p) || (*p & 0x80))) { p++; } if ((p + 1) < end && *p == '.' && - (is_atom (*(p + 1)) || *(p + 1) == '/')) { + (is_atom (*(p + 1)) || *(p + 1) == '/' || (*(p + 1) & 0x80))) { p++; } } @@ -1621,10 +1621,6 @@ passwd: } } - /* urls are extremely unlikely to end with any - * punctuation, so strip any trailing - * punctuation off. Also strip off any closing - * double-quotes. */ while (p > pos && strchr (",.:;?!-|}])\"", p[-1])) { p--; }