aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-05-16 14:05:43 +0200
committersfan5 <sfan5@live.de>2021-05-17 17:12:30 +0200
commitb56a028d6bc101cb01f5bdfe07053ac1af9fb016 (patch)
treeec2a4e9e29db37e7d505fa64daddeb075ce592ad /src/script/lua_api
parentd44f1aabbb25a68e915a4bd5c20b72ca393ba34c (diff)
downloadminetest-b56a028d6bc101cb01f5bdfe07053ac1af9fb016.tar.gz
minetest-b56a028d6bc101cb01f5bdfe07053ac1af9fb016.tar.bz2
minetest-b56a028d6bc101cb01f5bdfe07053ac1af9fb016.zip
Fix curl_timeout being ignored for Lua HTTP fetches
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_http.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/script/lua_api/l_http.cpp b/src/script/lua_api/l_http.cpp
index 5ea3b3f99..751ec9837 100644
--- a/src/script/lua_api/l_http.cpp
+++ b/src/script/lua_api/l_http.cpp
@@ -42,12 +42,10 @@ void ModApiHttp::read_http_fetch_request(lua_State *L, HTTPFetchRequest &req)
req.caller = httpfetch_caller_alloc_secure();
getstringfield(L, 1, "url", req.url);
- lua_getfield(L, 1, "user_agent");
- if (lua_isstring(L, -1))
- req.useragent = getstringfield_default(L, 1, "user_agent", "");
- lua_pop(L, 1);
+ getstringfield(L, 1, "user_agent", req.useragent);
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");
if (lua_isstring(L, -1)) {