diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-14 09:20:42 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-14 09:20:42 +0100 |
commit | 6cfd6d651b45a6cdbdb3baa8bbfdb69e685aeb45 (patch) | |
tree | 0af9b5db51663dd3dfec9efcdbcce158c7aecfdc | |
parent | 8b0c9d52554909656b8db2d8c93d8d680776de0b (diff) | |
download | rspamd-6cfd6d651b45a6cdbdb3baa8bbfdb69e685aeb45.tar.gz rspamd-6cfd6d651b45a6cdbdb3baa8bbfdb69e685aeb45.zip |
[Fix] Set host attribute properly when making HTTP request from lua
-rw-r--r-- | src/lua/lua_http.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 298da5a47..0c4eb976d 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -65,6 +65,7 @@ struct lua_http_cbdata { struct timeval tv; rspamd_inet_addr_t *addr; gchar *mime_type; + gchar *host; gint fd; gint cbref; }; @@ -110,6 +111,10 @@ lua_http_fin (gpointer arg) g_free (cbd->mime_type); } + if (cbd->host) { + g_free (cbd->host); + } + g_slice_free1 (sizeof (struct lua_http_cbdata), cbd); } @@ -210,7 +215,8 @@ lua_http_make_connection (struct lua_http_cbdata *cbd) NULL); rspamd_http_connection_write_message (cbd->conn, cbd->msg, - NULL, cbd->mime_type, cbd, fd, &cbd->tv, cbd->ev_base); + cbd->host, cbd->mime_type, cbd, fd, + &cbd->tv, cbd->ev_base); /* Message is now owned by a connection object */ cbd->msg = NULL; @@ -451,6 +457,10 @@ lua_http_request (lua_State *L) msec_to_tv (timeout, &cbd->tv); cbd->fd = -1; + if (msg->host) { + cbd->host = rspamd_fstring_cstr (msg->host); + } + if (session) { cbd->session = session; rspamd_session_add_event (session, |