1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-31 18:31:04 +00:00

Allow float values for HTTPRequest.timeout (#16442)

This commit is contained in:
whosit 2025-08-25 22:36:42 +03:00 committed by GitHub
parent 3f0f7f4285
commit 7cbe62fe7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,8 +39,9 @@ void ModApiHttp::read_http_fetch_request(lua_State *L, HTTPFetchRequest &req)
getstringfield(L, 1, "url", req.url); getstringfield(L, 1, "url", req.url);
getstringfield(L, 1, "user_agent", req.useragent); getstringfield(L, 1, "user_agent", req.useragent);
req.multipart = getboolfield_default(L, 1, "multipart", false); req.multipart = getboolfield_default(L, 1, "multipart", false);
if (getintfield(L, 1, "timeout", req.timeout)) float timeout_sec = 0;
req.timeout *= 1000; if (getfloatfield(L, 1, "timeout", timeout_sec))
req.timeout = timeout_sec * 1000;
lua_getfield(L, 1, "method"); lua_getfield(L, 1, "method");
if (lua_isstring(L, -1)) if (lua_isstring(L, -1))