Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
l_http.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 2.1 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License along
16with this program; if not, write to the Free Software Foundation, Inc.,
1751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20#pragma once
21
22#include "lua_api/l_base.h"
23#include "config.h"
24
25struct HTTPFetchRequest;
26struct HTTPFetchResult;
27
28class ModApiHttp : public ModApiBase {
29private:
30#if USE_CURL
31 // Helpers for HTTP fetch functions
32 static void read_http_fetch_request(lua_State *L, HTTPFetchRequest &req);
33 static void push_http_fetch_result(lua_State *L, HTTPFetchResult &res, bool completed = true);
34
35 // http_fetch_sync({url=, timeout=, data=})
36 static int l_http_fetch_sync(lua_State *L);
37
38 // http_fetch_async({url=, timeout=, data=})
39 static int l_http_fetch_async(lua_State *L);
40
41 // http_fetch_async_get(handle)
42 static int l_http_fetch_async_get(lua_State *L);
43
44 // request_http_api()
45 static int l_request_http_api(lua_State *L);
46
47 // get_http_api()
48 static int l_get_http_api(lua_State *L);
49#endif
50
51 // set_http_api_lua() [internal]
52 static int l_set_http_api_lua(lua_State *L);
53
54
55public:
56 static void Initialize(lua_State *L, int top);
57 static void InitializeAsync(lua_State *L, int top);
58};
Definition: l_base.h:43
Definition: l_http.h:28
static int l_http_fetch_async(lua_State *L)
Definition: l_http.cpp:125
static int l_http_fetch_sync(lua_State *L)
Definition: l_http.cpp:107
static int l_get_http_api(lua_State *L)
Definition: l_http.cpp:190
static int l_http_fetch_async_get(lua_State *L)
Definition: l_http.cpp:145
static int l_set_http_api_lua(lua_State *L)
Definition: l_http.cpp:204
static int l_request_http_api(lua_State *L)
Definition: l_http.cpp:165
static void push_http_fetch_result(lua_State *L, HTTPFetchResult &res, bool completed=true)
Definition: l_http.cpp:96
static void InitializeAsync(lua_State *L, int top)
Definition: l_http.cpp:244
static void read_http_fetch_request(lua_State *L, HTTPFetchRequest &req)
Definition: l_http.cpp:38
static void Initialize(lua_State *L, int top)
Definition: l_http.cpp:220
Definition: httpfetch.h:55
Definition: httpfetch.h:96