diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-09 15:05:16 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-09 15:27:32 +0100 |
commit | 58f2e1a3e3638ec6032bd4da5e4006e63fc04495 (patch) | |
tree | c4987494a5cb9358b49a9debc86bed20276878f4 /src | |
parent | d595b6ef94b3b1e1412cda2232fa4627ac67926e (diff) | |
download | rspamd-58f2e1a3e3638ec6032bd4da5e4006e63fc04495.tar.gz rspamd-58f2e1a3e3638ec6032bd4da5e4006e63fc04495.zip |
[Fix] Fix HTTP requests with no body
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_http.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index cbf30a07c..b9a2d7b59 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -555,7 +555,8 @@ lua_http_request (lua_State *L) body = rspamd_fstring_new_init (t->start, t->len); } else { - return luaL_error (L, "invalid body argument"); + return luaL_error (L, "invalid body argument type: %s", + lua_typename (L, lua_type (L, -1))); } } else if (lua_type (L, -1) == LUA_TTABLE) { @@ -573,16 +574,19 @@ lua_http_request (lua_State *L) body = rspamd_fstring_append (body, t->start, t->len); } else { - return luaL_error (L, "invalid body argument"); + return luaL_error (L, "invalid body argument: %s", + lua_typename (L, lua_type (L, -1))); } } else { - return luaL_error (L, "invalid body argument"); + return luaL_error (L, "invalid body argument type: %s", + lua_typename (L, lua_type (L, -1))); } } } - else { - return luaL_error (L, "invalid body argument"); + else if (lua_type (L, -1) != LUA_TNONE && lua_type (L, -1) != LUA_TNIL) { + return luaL_error (L, "invalid body argument type: %s", + lua_typename (L, lua_type (L, -1))); } lua_pop (L, 1); |