From cfec9a7e9d3dc7f8d92997dad563f6e9a421eb71 Mon Sep 17 00:00:00 2001 From: Ground0 Date: Wed, 29 Mar 2023 10:40:17 +0200 Subject: [PATCH] Updated header and added private header --- inc/lweb_header_privat.pbi | 117 +++++++++++++++++++++++++++++++++++++ lweb_header.pbi | 17 ++++-- 2 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 inc/lweb_header_privat.pbi diff --git a/inc/lweb_header_privat.pbi b/inc/lweb_header_privat.pbi new file mode 100644 index 0000000..a341e9f --- /dev/null +++ b/inc/lweb_header_privat.pbi @@ -0,0 +1,117 @@ +;******************************** +;* +;* lweb_header_privat.pbi +;* +;* LiHaSo Webserver Modul Header/Declare Privatmodule +;* +;* It is usable as standalone Webserver, look at lhttpd.pb +;* +;* +;* + + Structure server_http + enabled.i + port.i + binding.s + max_clients.i + reuse.b + thread_id.i + EndStructure + + Structure server_https + enabled.i + port.i + binding.s + max_clients.i + reuse.b + CA.s + Certs.s + key.s + key_pass.s + thread_id.i + server_id.i + EndStructure + + Structure server_cache + time.i + maxsize.i + current.i + enable.i + EndStructure + + Structure memory + MaxFileSize.i + DefaultBlockSize.i + EndStructure + + Structure log_config + DebuglogUUID.s + DebuglogFile.s + Debugdisable.i + AccesslogFile.s + AccesslogUUID.s + ErrorlogFile.s + ErrorlogUUID.s + CachelogFile.s + CachelogUUID.s + EndStructure + + Enumeration http_header_fieldtype + #http_header_field_Static ;Fieldcontent could be directly used + #http_header_field_Dynamic_auto ;Must be handled by the Fieldcontent_proc + EndEnumeration + + Enumeration http_headerfield_param + #http_headerfield_param_string + #http_headerfield_param_map + #http_headerfield_param_integer + EndEnumeration + + Structure http_headerfield_params + Type.i ;Types of Field #Content or #Map + Content_string.s ;String Field + Map Content_Maps.s() ;Map Field + Content_integer.i ;Integer Field + EndStructure + + Structure http_headerfield + Fieldname.s ; Name bevore : for ex. "keep-alive:" + Fieldcontent.s ; Content after : for ex. "Keep-Alive" + Fieldcontent_type.i ; #http_header_field_Static or #http_header_field_Dynamic_auto + Fieldcontent_proc.i ; A Procedure Prototype to call + Map Field_proc_parameters.http_headerfield_params() ;Parameters to give to call + EndStructure + + IncludeFile "lweb_http_status_header_private.pbi" + + + Structure host + description.s + http.server_http + https.server_https + cache.server_cache + log.log_config + mem.memory + defaultfile.s + basedir.s + Map status.http_status_codes() ;Individual Error Messages and Headers + EndStructure + + Structure config_loader + name.s + type.s + configtype.s + EndStructure + + Structure server + Map hosts.host() + Map status.http_status_codes() ;Default Error Messages and Headers + Map config_file.config_loader() ;Map Key is Type and string is file + log.log_config + mem.memory + global_max_cli_threads.i ;The maximum Thread Count = 0 unlimited + global_max_cli_memory.i ;The maximum Used Memory per Client Thread = 0 unlimited + version.s + identifikation.s + type.i + EndStructure \ No newline at end of file diff --git a/lweb_header.pbi b/lweb_header.pbi index 12fede5..95ef01f 100644 --- a/lweb_header.pbi +++ b/lweb_header.pbi @@ -10,7 +10,6 @@ ;* EnableExplicit -XIncludeFile "lhs_lib/SYS/lhs_log.pbi" CompilerIf #PB_Compiler_Thread = 0 CompilerError "Muss Threadsicher Kompiliert werden" @@ -41,7 +40,6 @@ DeclareModule lhs_web #conf_HTTPS_Port #conf_HTTPS_Binding #conf_HTTPS_Enable - #conf_debug_logfile #conf_debug_disable #conf_Access_logfile #conf_Access_logUUID @@ -49,6 +47,7 @@ DeclareModule lhs_web #conf_Error_logUUID #conf_Cache_logfile #conf_Cache_logUUID + #conf_Debug_logUUID #conf_runfile EndEnumeration @@ -104,10 +103,20 @@ DeclareModule lhs_web Declare set_config(parameter.i=#conf_defaultfile, setting.s="index.html") Declare.s get_config(parameter.i=#conf_defaultfile) - Declare start_server() + ;Declare.s get_config(parameter.i=#conf_defaultfile) + Declare.s http_server_prepare(http_port.i = 8080, http_binding.s = "127.0.0.1", https_port.i=8443, https_binding.s="127.0.0.1", https_enabled.b = #False) + Declare main_server(id.i) + Declare server_start() + + XIncludeFile "inc/lweb_server_cfg_header.pbi" + + Declare server_reload(UUID.s) + Declare server_config(UUID.s, XMLStructure.s) + Declare server_stop(UUID.s = "all") Declare.s register_client_handler(Route.s, Callback.i, AppPrototype.i = #handler_proto_get, RouteType.i = #handler_sub) XIncludeFile "inc/lweb_IP_header.pbi" XIncludeFile "inc/lweb_helper_header.pbi" - + XIncludeFile "inc/lweb_http_status_header.pbi" + EndDeclareModule \ No newline at end of file