diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-23 13:27:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-23 13:27:45 +0000 |
commit | d050686aee0ad85364ceae6185c1e2698feb3e6e (patch) | |
tree | 48b7b47b1f55b27a87d6ebcf3a62f5bc2a75ad72 /src/libserver/url.h | |
parent | 1762eb9af61997d9acc3017e2e0fc6153b09acc2 (diff) | |
download | rspamd-d050686aee0ad85364ceae6185c1e2698feb3e6e.tar.gz rspamd-d050686aee0ad85364ceae6185c1e2698feb3e6e.zip |
[Feature] Add url encoding function
Diffstat (limited to 'src/libserver/url.h')
-rw-r--r-- | src/libserver/url.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libserver/url.h b/src/libserver/url.h index dbe3eb00b..f56649558 100644 --- a/src/libserver/url.h +++ b/src/libserver/url.h @@ -177,4 +177,31 @@ void rspamd_url_add_tag (struct rspamd_url *url, const gchar *tag, const gchar *value, rspamd_mempool_t *pool); +guint rspamd_url_hash (gconstpointer u); + +/* Compare two emails for building emails hash */ +gboolean rspamd_emails_cmp (gconstpointer a, gconstpointer b); + +/* Compare two urls for building emails hash */ +gboolean rspamd_urls_cmp (gconstpointer a, gconstpointer b); + +/** + * Decode URL encoded string in-place and return new length of a string, src and dst are NULL terminated + * @param dst + * @param src + * @param size + * @return + */ +gsize rspamd_url_decode (gchar *dst, const gchar *src, gsize size); + +/** + * Encode url if needed. In this case, memory is allocated from the specific pool. + * Returns pointer to begin and encoded length in `dlen` + * @param url + * @param pool + * @return + */ +const gchar * rspamd_url_encode (struct rspamd_url *url, gsize *dlen, + rspamd_mempool_t *pool); + #endif |