diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-20 13:51:53 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-20 13:51:53 +0000 |
commit | f33d6b0d3f2fd5418c9380e99fa27e141e5226b4 (patch) | |
tree | 19cc6ba5bd613cbe747cf6406edc2fdb9e457cbd /src | |
parent | 70587665134f09d332f24eb4bf80b8baad8c0cb1 (diff) | |
download | rspamd-f33d6b0d3f2fd5418c9380e99fa27e141e5226b4.tar.gz rspamd-f33d6b0d3f2fd5418c9380e99fa27e141e5226b4.zip |
[Minor] Normalise backslashes to slashes in urls
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/url.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c index 985df24ac..9b1fa9309 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -2124,6 +2124,21 @@ rspamd_url_parse (struct rspamd_url *uri, } } } + + /* Replace stupid '\' with '/' after schema */ + if (uri->protocol & (PROTOCOL_HTTP|PROTOCOL_HTTPS|PROTOCOL_FTP) && + uri->protocollen > 0 && uri->urllen > uri->protocollen + 2) { + + gchar *pos = &uri->string[uri->protocollen], *host_start = uri->host; + + while (pos < host_start) { + if (*pos == '\\') { + *pos = '/'; + uri->flags |= RSPAMD_URL_FLAG_OBSCURED; + } + pos ++; + } + } } else if (uri->protocol & PROTOCOL_TELEPHONE) { /* We need to normalise phone number: remove all spaces and braces */ |