diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-07 22:45:09 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-07 22:45:09 +0100 |
commit | 0fce52b8d5ead7d0964b38ffdf44ba85f257f866 (patch) | |
tree | cefb854456d186b29978e6fb2e96fd14ff51cd55 | |
parent | f29ecb6a74cd7aea7c67682b5b6172c4094253dd (diff) | |
download | rspamd-0fce52b8d5ead7d0964b38ffdf44ba85f257f866.tar.gz rspamd-0fce52b8d5ead7d0964b38ffdf44ba85f257f866.zip |
Use rspamd{text} in lua_http.
-rw-r--r-- | src/lua/lua_http.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 07c0d7d98..9e1082dcf 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -228,6 +228,7 @@ lua_http_request (lua_State *L) struct lua_http_cbdata *cbd; struct rspamd_dns_resolver *resolver; struct rspamd_async_session *session; + struct rspamd_lua_text *t; gdouble timeout = default_http_timeout; if (lua_gettop (L) >= 2) { @@ -335,6 +336,16 @@ lua_http_request (lua_State *L) if (lua_type (L, -1) == LUA_TSTRING) { msg->body = g_string_new (lua_tostring (L, -1)); } + else if (lua_type (L, -1) == LUA_TUSERDATA) { + t = lua_check_text (L, -1); + if (t) { + /* XXX: is it safe ? */ + msg->body = g_string_new (NULL); + msg->body->str = (gchar *)t->start; + msg->body->len = t->len; + } + } + lua_pop (L, 1); } else { |