aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_http.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/lua_http.c')
-rw-r--r--src/lua/lua_http.c11
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 {