diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-08-12 20:11:48 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-08-12 20:26:17 +0100 |
commit | 5872d86b36faf357a1c5b4468abfafd7978d2a68 (patch) | |
tree | bf9b074f0594bc73578e200d544ce94267441a0e | |
parent | 9aa7fa543584b9d193d302b584c224b40e20a62c (diff) | |
download | rspamd-5872d86b36faf357a1c5b4468abfafd7978d2a68.tar.gz rspamd-5872d86b36faf357a1c5b4468abfafd7978d2a68.zip |
[Fix] Lowercase HTTP headers to make them searchable from Lua
-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 34a31bde8..ad2a7d981 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); @@ -607,6 +612,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); |