const gchar *p, *s;
gchar *d;
guint i, dlen;
- gboolean has_bad_chars = FALSE;
+ gboolean has_bad_chars = FALSE, no_prefix = FALSE;
static const gchar hexdigests[16] = "0123456789abcdef";
p = start;
}
}
+ if (rspamd_substring_search (s, len, "://", 3) == (-1)) {
+ /* We have no prefix */
+ dlen += sizeof ("http://") - 1;
+ no_prefix = TRUE;
+ }
+
decoded = rspamd_mempool_alloc (pool, dlen + 1);
d = decoded;
+ if (no_prefix) {
+ memcpy (d, "http://", sizeof ("http://") - 1);
+ d += sizeof ("http://") - 1;
+ }
+
/* We also need to remove all internal newlines and encode unsafe characters */
for (i = 0; i < len; i ++) {
if (G_UNLIKELY (s[i] == '\r' || s[i] == '\n')) {