Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
l_http.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "lua_api/l_base.h"
8#include "config.h"
9
10struct HTTPFetchRequest;
11struct HTTPFetchResult;
12
13class ModApiHttp : public ModApiBase {
14private:
15#if USE_CURL
16 // Helpers for HTTP fetch functions
17 static void read_http_fetch_request(lua_State *L, HTTPFetchRequest &req);
18 static void push_http_fetch_result(lua_State *L, HTTPFetchResult &res, bool completed = true);
19
20 // http_fetch_sync({url=, timeout=, data=})
21 static int l_http_fetch_sync(lua_State *L);
22
23 // http_fetch_async({url=, timeout=, data=})
24 static int l_http_fetch_async(lua_State *L);
25
26 // http_fetch_async_get(handle)
27 static int l_http_fetch_async_get(lua_State *L);
28
29 // request_http_api()
30 static int l_request_http_api(lua_State *L);
31
32 // get_http_api()
33 static int l_get_http_api(lua_State *L);
34#endif
35
36 // set_http_api_lua() [internal]
37 static int l_set_http_api_lua(lua_State *L);
38
39
40public:
41 static void Initialize(lua_State *L, int top);
42 static void InitializeAsync(lua_State *L, int top);
43};
Definition l_base.h:28
Definition l_http.h:13
static int l_http_fetch_async(lua_State *L)
Definition l_http.cpp:110
static int l_http_fetch_sync(lua_State *L)
Definition l_http.cpp:92
static int l_get_http_api(lua_State *L)
Definition l_http.cpp:175
static int l_http_fetch_async_get(lua_State *L)
Definition l_http.cpp:130
static int l_set_http_api_lua(lua_State *L)
Definition l_http.cpp:189
static int l_request_http_api(lua_State *L)
Definition l_http.cpp:150
static void push_http_fetch_result(lua_State *L, HTTPFetchResult &res, bool completed=true)
Definition l_http.cpp:81
static void InitializeAsync(lua_State *L, int top)
Definition l_http.cpp:229
static void read_http_fetch_request(lua_State *L, HTTPFetchRequest &req)
Definition l_http.cpp:23
static void Initialize(lua_State *L, int top)
Definition l_http.cpp:205
Definition httpfetch.h:40
Definition httpfetch.h:81