aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-02 13:55:08 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-02 13:55:08 +0000
commit98c3c22dcd7d5bc6c4da9730e31006349ea90f82 (patch)
treefdd90330a1a0b288ff2f7eee41de9b2c46fd4534
parentc49bd73c79e4c900b239aca4c0388351621ca457 (diff)
downloadrspamd-98c3c22dcd7d5bc6c4da9730e31006349ea90f82.tar.gz
rspamd-98c3c22dcd7d5bc6c4da9730e31006349ea90f82.zip
Some fixes to lua_http.
-rw-r--r--src/lua/lua_http.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index 8803df80c..12b0072d3 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -148,7 +148,7 @@ lua_http_make_connection (struct lua_http_cbdata *cbd)
fd = rspamd_inet_address_connect (&cbd->addr, SOCK_STREAM, TRUE);
if (fd == -1) {
- lua_http_maybe_free (cbd);
+ msg_info ("cannot connect to %v", cbd->msg->host);
return FALSE;
}
cbd->conn = rspamd_http_connection_new (NULL, lua_http_error_handler,
@@ -191,15 +191,15 @@ lua_http_push_headers (lua_State *L, struct rspamd_http_message *msg)
lua_pushnil (L);
while (lua_next (L, -2) != 0) {
- name = rspamd_lua_table_get (L, "name");
- value = rspamd_lua_table_get (L, "value");
+ lua_pushvalue (L, -2);
+ name = lua_tostring (L, -1);
+ value = lua_tostring (L, -2);
if (name != NULL && value != NULL) {
rspamd_http_message_add_header (msg, name, value);
}
- lua_pop (L, 1);
+ lua_pop (L, 2);
}
- lua_pop (L, 1);
}
static gint
@@ -331,8 +331,10 @@ lua_http_request (lua_State *L)
cbd->L = L;
cbd->cbref = cbref;
cbd->msg = msg;
+ cbd->ev_base = ev_base;
msec_to_tv (timeout, &cbd->tv);
if (session) {
+ cbd->session = session;
register_async_event (session,
(event_finalizer_t)lua_http_fin,
cbd,