Fix curl_timeout being ignored for Lua HTTP fetches

This commit is contained in:
sfan5 2021-05-16 14:05:43 +02:00
parent d44f1aabbb
commit b56a028d6b

@ -42,12 +42,10 @@ void ModApiHttp::read_http_fetch_request(lua_State *L, HTTPFetchRequest &req)
req.caller = httpfetch_caller_alloc_secure(); req.caller = httpfetch_caller_alloc_secure();
getstringfield(L, 1, "url", req.url); getstringfield(L, 1, "url", req.url);
lua_getfield(L, 1, "user_agent"); getstringfield(L, 1, "user_agent", req.useragent);
if (lua_isstring(L, -1))
req.useragent = getstringfield_default(L, 1, "user_agent", "");
lua_pop(L, 1);
req.multipart = getboolfield_default(L, 1, "multipart", false); req.multipart = getboolfield_default(L, 1, "multipart", false);
req.timeout = getintfield_default(L, 1, "timeout", 3) * 1000; if (getintfield(L, 1, "timeout", req.timeout))
req.timeout *= 1000;
lua_getfield(L, 1, "method"); lua_getfield(L, 1, "method");
if (lua_isstring(L, -1)) { if (lua_isstring(L, -1)) {