diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-08-12 20:11:48 +0100 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-08-28 13:07:33 +0200 |
commit | f8d42f581eb0c1eb4fe90a46317fa97024199102 (patch) | |
tree | d77c1d2b2e9c544576d175a7459b31cea12619d3 /src/lua/lua_http.c | |
parent | 4f16ae613599b3af2df3b3773e06d1025e7623db (diff) | |
download | rspamd-f8d42f581eb0c1eb4fe90a46317fa97024199102.tar.gz rspamd-f8d42f581eb0c1eb4fe90a46317fa97024199102.zip |
[Fix] Lowercase HTTP headers to make them searchable from Lua
Diffstat (limited to 'src/lua/lua_http.c')
-rw-r--r-- | src/lua/lua_http.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index a655b8ec0..99a967db7 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -68,6 +68,7 @@ struct lua_http_cbdata { rspamd_inet_addr_t *addr; gchar *mime_type; gchar *host; + const gchar *url; gsize max_size; gint flags; gint fd; @@ -202,6 +203,10 @@ lua_http_finish_handler (struct rspamd_http_connection *conn, lua_newtable (cbd->L); HASH_ITER (hh, msg->headers, h, htmp) { + /* + * Lowercase header name, as Lua cannot search in caseless matter + */ + rspamd_str_lc (h->combined->str, h->name->len); lua_pushlstring (cbd->L, h->name->begin, h->name->len); lua_pushlstring (cbd->L, h->value->begin, h->value->len); lua_settable (cbd->L, -3); @@ -604,6 +609,7 @@ lua_http_request (lua_State *L) cbd->local_kp = local_kp; cbd->flags = flags; cbd->max_size = max_size; + cbd->url = url; if (msg->host) { cbd->host = rspamd_fstring_cstr (msg->host); |