rc = rspamd_url_parse (url, decoded, dlen, pool, RSPAMD_URL_PARSE_HREF);
- if (rc == URI_ERRNO_OK) {
+ /* Filter some completely damaged urls */
+ if (rc == URI_ERRNO_OK && url->hostlen > 0 &&
+ !((url->flags & RSPAMD_URL_FLAG_OBSCURED) && (url->protocol & PROTOCOL_UNKNOWN))) {
url->flags |= saved_flags;
if (has_bad_chars) {
/* Parse remaining */
switch (st) {
case parse_domain:
- if (p - c == 0) {
+ if (p - c == 0 || !is_domain (*(p - 1)) || !is_domain (*c)) {
goto out;
}
SET_U (u, UF_HOST);
}
else {
/* Hack, hack, hack */
- uri->protocol = PROTOCOL_HTTP;
+ uri->protocol = PROTOCOL_UNKNOWN;
}
}