summaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-08-05 15:29:20 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-08-05 15:29:20 +0400
commit056022ac333bc46410e76b3469dca8c563d53e8c (patch)
treeb4e3c0eae8665f5946035937f0ffe32a233a186e /src/url.c
parenta9c4a7af9415b57397687bd3005dfcd96a01881d (diff)
downloadrspamd-056022ac333bc46410e76b3469dca8c563d53e8c.tar.gz
rspamd-056022ac333bc46410e76b3469dca8c563d53e8c.zip
* Strip urls from space characters
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/url.c b/src/url.c
index e11d30f82..c089f4275 100644
--- a/src/url.c
+++ b/src/url.c
@@ -400,6 +400,22 @@ url_unescape (char *s)
*t = '\0';
}
+static void
+url_strip (char *s)
+{
+ char *t = s; /* t - tortoise */
+ char *h = s; /* h - hare */
+
+ while (*h) {
+ if (g_ascii_isgraph (*h)) {
+ *t = *h;
+ t ++;
+ }
+ h++;
+ }
+ *t = '\0';
+}
+
/* The core of url_escape_* functions. Escapes the characters that
match the provided mask in urlchr_table.
@@ -870,6 +886,8 @@ parse_uri(struct uri *uri, unsigned char *uristring, memory_pool_t *pool)
if (strchr (uri->host, '%')) {
uri->hostlen = url_calculate_escaped_hostlen (uri->host, uri->hostlen);
}
+
+ url_strip (struri (uri));
url_unescape (uri->host);
path_simplify (uri->data);