Moved http server simple to it's own module.

This commit is contained in:
Relintai 2022-08-19 22:09:30 +02:00
parent e2d42db711
commit 1ef37c61c2
22 changed files with 122 additions and 25 deletions

View File

@ -0,0 +1,29 @@
import os
Import('env')
module_env = env.Clone()
sources = [
"register_types.cpp",
"http_server_simple.cpp",
"web_server_simple.cpp",
"simple_web_server_request.cpp",
"http_parser.cpp",
"http_writer.cpp",
"http_parser/http_parser.c",
]
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
# Shared lib compilation
module_env.Append(CCFLAGS=['-fPIC'])
module_env['LIBS'] = []
shared_lib = module_env.SharedLibrary(target='#bin/http_server_simple', source=sources)
shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0]
env.Append(LIBS=[shared_lib_shim])
env.Append(LIBPATH=['#bin'])
else:
# Static compilation
module_env.add_source_files(env.modules_sources, sources)

View File

@ -0,0 +1,20 @@
def can_build(env, platform):
env.module_add_dependencies("http_server_simple", ["web"], False)
return True
def configure(env):
pass
def get_doc_classes():
return [
"WebServerSimple",
]
def get_doc_path():
return "doc_classes"

View File

@ -1,6 +1,6 @@
#include "http_parser.h"
#include "../http/web_server_request.h"
#include "modules/web/http/web_server_request.h"
#include "./http_parser/http_parser.h"
#include "simple_web_server_request.h"

View File

@ -30,7 +30,7 @@
#include "http_server_simple.h"
#include "../http/web_server_cookie.h"
#include "modules/web/http/web_server_cookie.h"
#include "http_parser.h"
#include "simple_web_server_request.h"
#include "web_server_simple.h"

View File

@ -41,7 +41,7 @@
#include "core/config/project_settings.h"
#include "../http/http_server_enums.h"
#include "modules/web/http/http_server_enums.h"
class HTTPParser;
class WebServerSimple;

View File

@ -0,0 +1,33 @@
/*
Copyright (c) 2022 Péter Magyar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "register_types.h"
#include "web_server_simple.h"
void register_http_server_simple_types() {
ClassDB::register_class<WebServerSimple>();
}
void unregister_http_server_simple_types() {
}

View File

@ -0,0 +1,28 @@
#ifndef HTTP_SERVER_SIMPLE_REGISTER_TYPES_H
#define HTTP_SERVER_SIMPLE_REGISTER_TYPES_H
/*
Copyright (c) 2022 Péter Magyar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
void register_http_server_simple_types();
void unregister_http_server_simple_types();
#endif

View File

@ -1,15 +1,15 @@
#include "simple_web_server_request.h"
#include "../http/web_server.h"
#include "../http/web_server_cookie.h"
#include "modules/web/http/web_server.h"
#include "modules/web/http/web_server_cookie.h"
#include "core/object/object.h"
#include "../http/http_session.h"
#include "modules/web/http/http_session.h"
#include "../http/http_session_manager.h"
#include "../http/web_node.h"
#include "modules/web/http/http_session_manager.h"
#include "modules/web/http/web_node.h"
#include "../http/web_permission.h"
#include "modules/web/http/web_permission.h"
#include "http_server_simple.h"
String SimpleWebServerRequest::get_cookie(const String &key) {

View File

@ -6,9 +6,9 @@
#include "core/string/ustring.h"
#include "core/containers/vector.h"
#include "../http/web_server_request.h"
#include "modules/web/http/web_server_request.h"
#include "../http/http_server_enums.h"
#include "modules/web/http/http_server_enums.h"
class WebServer;
class WebServerCookie;

View File

@ -37,7 +37,7 @@
#include "core/io/zip_io.h"
#include "core/os/mutex.h"
#include "../http/web_server.h"
#include "modules/web/http/web_server.h"
#include "core/config/project_settings.h"

View File

@ -40,13 +40,6 @@ sources = [
"html/libs/hoedown/version.c",
"html/markdown_renderer.cpp",
"http_server_simple/http_server_simple.cpp",
"http_server_simple/web_server_simple.cpp",
"http_server_simple/simple_web_server_request.cpp",
"http_server_simple/http_parser.cpp",
"http_server_simple/http_writer.cpp",
"http_server_simple/http_parser/http_parser.c",
"nodes/static_pages/static_web_page.cpp",
"nodes/static_pages/static_web_page_file.cpp",
"nodes/static_pages/static_web_page_folder_files.cpp",

View File

@ -60,8 +60,6 @@ def get_doc_classes():
"MarkdownRenderer",
"WebServerSimple",
"StaticWebPage",
"StaticWebPageFile",
"StaticWebPageFolderFiles",

View File

@ -45,8 +45,6 @@ SOFTWARE.
#include "http/web_server_middleware.h"
#include "http/web_server_request.h"
#include "http_server_simple/web_server_simple.h"
#include "nodes/static_pages/static_web_page.h"
#include "nodes/static_pages/static_web_page_file.h"
#include "nodes/static_pages/static_web_page_folder_files.h"
@ -111,8 +109,6 @@ void register_web_types() {
ClassDB::register_class<WebServerMiddleware>();
ClassDB::register_class<WebServerRequest>();
ClassDB::register_class<WebServerSimple>();
ClassDB::register_class<StaticWebPage>();
ClassDB::register_class<StaticWebPageFile>();
ClassDB::register_class<StaticWebPageFolderFiles>();