aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parenta9c4a7af9415b57397687bd3005dfcd96a01881d (diff)
downloadrspamd-056022ac333bc46410e76b3469dca8c563d53e8c.tar.gz
rspamd-056022ac333bc46410e76b3469dca8c563d53e8c.zip
* Strip urls from space characters
Diffstat (limited to 'src')
-rw-r--r--src/html.c1
-rw-r--r--src/url.c18
2 files changed, 18 insertions, 1 deletions
diff --git a/src/html.c b/src/html.c
index 891962643..8f5664079 100644
--- a/src/html.c
+++ b/src/html.c
@@ -394,7 +394,6 @@ parse_tag_url (struct worker_task *task, struct mime_text_part *part, tag_id_t i
url_text = memory_pool_alloc (task->task_pool, len + 1);
g_strlcpy (url_text, c, len + 1);
- g_strstrip (url_text);
decode_entitles (url_text);
url = memory_pool_alloc (task->task_pool, sizeof (struct uri));
rc = parse_uri (url, url_text, task->task_pool);
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);