rename functions

This commit is contained in:
MihailRis 2024-11-24 07:58:07 +03:00
parent db5dada519
commit 90155dd05b
2 changed files with 6 additions and 5 deletions

View File

@ -5,7 +5,7 @@
using namespace scripting;
static int l_http_get(lua::State* L) {
static int l_get(lua::State* L) {
std::string url(lua::require_lstring(L, 1));
lua::pushvalue(L, 2);
@ -19,7 +19,7 @@ static int l_http_get(lua::State* L) {
return 0;
}
static int l_http_get_binary(lua::State* L) {
static int l_get_binary(lua::State* L) {
std::string url(lua::require_lstring(L, 1));
lua::pushvalue(L, 2);
@ -37,7 +37,7 @@ static int l_http_get_binary(lua::State* L) {
}
const luaL_Reg networklib[] = {
{"http_get", lua::wrap<l_http_get>},
{"http_get_binary", lua::wrap<l_http_get_binary>},
{"get", lua::wrap<l_get>},
{"get_binary", lua::wrap<l_get_binary>},
{NULL, NULL}
};

View File

@ -29,6 +29,7 @@ struct Request {
OnResponse onResponse;
OnReject onReject;
long maxSize;
bool followLocation = false;
};
class CurlRequests : public Requests {
@ -79,7 +80,7 @@ public:
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, request.followLocation);
if (request.maxSize == 0) {
curl_easy_setopt(
curl, CURLOPT_MAXFILESIZE, std::numeric_limits<long>::max()