diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-25 18:33:48 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-09-25 18:33:48 +0100 |
commit | f3d09eddea1bc2f7a56db339a75cb66e61502c88 (patch) | |
tree | 623a5370852bc38edcb6b558c974ea8c7bcf7ba0 /src/libserver/url.c | |
parent | 895d678b90f1e957154bace185e1310f77e6cf66 (diff) | |
download | rspamd-f3d09eddea1bc2f7a56db339a75cb66e61502c88.tar.gz rspamd-f3d09eddea1bc2f7a56db339a75cb66e61502c88.zip |
[Minor] Fix protocol encoding
Diffstat (limited to 'src/libserver/url.c')
-rw-r--r-- | src/libserver/url.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c index d770b2191..ec43404f9 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -3487,16 +3487,23 @@ rspamd_url_encode (struct rspamd_url *url, gsize *pdlen, } /* Need to encode */ - dlen += url->urllen; + dlen += url->urllen + sizeof ("telephone://"); /* Protocol hack */ dest = rspamd_mempool_alloc (pool, dlen + 1); d = dest; dend = d + dlen; if (url->protocollen > 0) { - const gchar *known_proto = rspamd_url_protocol_name (url->protocol); - d += rspamd_snprintf ((gchar *) d, dend - d, - "%s://", - known_proto); + if (!(url->protocol & PROTOCOL_UNKNOWN)) { + const gchar *known_proto = rspamd_url_protocol_name (url->protocol); + d += rspamd_snprintf ((gchar *) d, dend - d, + "%s://", + known_proto); + } + else { + d += rspamd_snprintf ((gchar *) d, dend - d, + "%*s://", + (gint)url->protocollen, url->string); + } } else { d += rspamd_snprintf ((gchar *) d, dend - d, "http://"); |