aboutsummaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-05 17:48:20 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-05 17:48:20 +0400
commit52e71f9ed43b0e0f7f030eb0f0b56a887978cf8a (patch)
tree9496a3ea6f3b95006554b003e01425e6b68b2765 /src/url.c
parentbae637bec8e9c23668cbacbb9f5a1bd829cae487 (diff)
downloadrspamd-52e71f9ed43b0e0f7f030eb0f0b56a887978cf8a.tar.gz
rspamd-52e71f9ed43b0e0f7f030eb0f0b56a887978cf8a.zip
* Fix detection of numeric urls (reported by citrin)
* Write real time of message's scan to log (not only virtual)
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/url.c b/src/url.c
index e560128f3..277b234b8 100644
--- a/src/url.c
+++ b/src/url.c
@@ -254,7 +254,7 @@ get_protocol (unsigned char *name, int namelen)
pname = protocol_backends[protocol].name;
pnamelen = strlen (pname);
minlen = MIN (pnamelen, namelen);
- compare = strncasecmp (pname, name, minlen);
+ compare = g_ascii_strncasecmp (pname, name, minlen);
if (compare == 0) {
if (pnamelen == namelen)
@@ -670,6 +670,14 @@ parse_uri (struct uri *uri, unsigned char *uristring, memory_pool_t * pool)
/* Assume http as default protocol */
if (!uri->protocollen || (uri->protocol = get_protocol (struri (uri), uri->protocollen)) == PROTOCOL_UNKNOWN) {
+ /* Make exception for numeric urls */
+ p = uri->string;
+ while (*p && (g_ascii_isalnum (*p) || *p == ':')) {
+ p ++;
+ }
+ if (*p == '\0') {
+ return URI_ERRNO_INVALID_PROTOCOL;
+ }
p = g_strconcat ("http://", uri->string, NULL);
uri->string = memory_pool_strdup (pool, p);
g_free (p);
@@ -912,12 +920,15 @@ url_parse_text (memory_pool_t * pool, struct worker_task *task, struct mime_text
if (new != NULL) {
g_strstrip (url_str);
rc = parse_uri (new, url_str, pool);
- if (rc != URI_ERRNO_EMPTY && rc != URI_ERRNO_NO_HOST) {
+ if (rc == URI_ERRNO_OK || rc == URI_ERRNO_NO_SLASHES || rc == URI_ERRNO_NO_HOST_SLASH) {
if (g_tree_lookup (is_html ? part->html_urls : part->urls, url_str) == NULL) {
g_tree_insert (is_html ? part->html_urls : part->urls, url_str, new);
task->urls = g_list_prepend (task->urls, new);
}
}
+ else {
+ msg_info ("extract of url '%s' failed: %s", url_str, url_strerror (rc));
+ }
}
}
}