diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-01 17:18:32 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-01 17:18:32 +0100 |
commit | a40bad22fe2d8ad447bb5c75d648b1bfeb5f129f (patch) | |
tree | 019495b2c38ae31cadf4529e67031478b55f231a /src/libserver/url.c | |
parent | 5e6082be921b46af1884661d749297a6c00ab7e2 (diff) | |
download | rspamd-a40bad22fe2d8ad447bb5c75d648b1bfeb5f129f.tar.gz rspamd-a40bad22fe2d8ad447bb5c75d648b1bfeb5f129f.zip |
Fix complicated case of percent encoding.
Diffstat (limited to 'src/libserver/url.c')
-rw-r--r-- | src/libserver/url.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c index 655f84a60..a4a92b14c 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -737,7 +737,7 @@ rspamd_web_parse (struct http_parser_url *u, const gchar *str, gsize len, p ++; } else { - if (*p != '.' && *p != '-' && *p != '_') { + if (*p != '.' && *p != '-' && *p != '_' && *p != '%') { uc = g_utf8_get_char_validated (p, last - p); if (uc == (gunichar)-1) { @@ -1127,7 +1127,25 @@ rspamd_url_parse (struct rspamd_url *uri, gchar *uristring, gsize len, /* Now decode url symbols */ uri->string = p; uri->urllen = len; - rspamd_unescape_uri (uri->string, uri->string, len); + + if (uri->userlen == 0) { + rspamd_unescape_uri (uri->string, uri->string, len); + } + else { + rspamd_unescape_uri (uri->string, uri->string, uri->protocollen); + rspamd_unescape_uri (uri->host, uri->host, uri->hostlen); + + if (uri->datalen) { + rspamd_unescape_uri (uri->data, uri->data, uri->datalen); + } + if (uri->querylen) { + rspamd_unescape_uri (uri->query, uri->query, uri->querylen); + } + if (uri->fragmentlen) { + rspamd_unescape_uri (uri->fragment, uri->fragment, uri->fragmentlen); + } + } + rspamd_str_lc (uri->string, uri->protocollen); rspamd_str_lc_utf8 (uri->host, uri->hostlen); |