2020-11-03 19:09:17 +01:00
|
|
|
;********************************
|
|
|
|
;*
|
|
|
|
;* lweb_header.pbi
|
|
|
|
;*
|
2020-11-30 09:52:27 +01:00
|
|
|
;* LiHaSo Webserver Modul Header/Declare
|
2020-11-03 19:09:17 +01:00
|
|
|
;*
|
2020-11-30 09:52:27 +01:00
|
|
|
;* It is usable as standalone Webserver, look at lwebd.pb
|
2020-11-03 19:09:17 +01:00
|
|
|
;*
|
|
|
|
;*
|
|
|
|
;*
|
|
|
|
|
|
|
|
EnableExplicit
|
2021-05-21 07:45:23 +02:00
|
|
|
|
2020-11-03 19:09:17 +01:00
|
|
|
CompilerIf #PB_Compiler_Thread = 0
|
|
|
|
CompilerError "Muss Threadsicher Kompiliert werden"
|
|
|
|
CompilerEndIf
|
|
|
|
|
|
|
|
DeclareModule lhs_web
|
|
|
|
;********************************
|
|
|
|
;*
|
|
|
|
;* Proceduren Deklarierung
|
|
|
|
;*
|
|
|
|
|
|
|
|
Enumeration e_conf
|
2020-11-30 10:04:29 +01:00
|
|
|
#conf_HTTP_port
|
|
|
|
#conf_HTTP_binding
|
2020-11-03 19:09:17 +01:00
|
|
|
#conf_defaultfile
|
|
|
|
#conf_basedir
|
|
|
|
#conf_error400
|
2020-11-30 10:04:29 +01:00
|
|
|
#conf_max_HTTP_clients
|
|
|
|
#conf_max_HTTPS_clients
|
2022-02-17 14:20:25 +01:00
|
|
|
#conf_File_max_in_Memory
|
|
|
|
#conf_File_BlockSize
|
2020-11-03 19:09:17 +01:00
|
|
|
#conf_server_type
|
|
|
|
#conf_cache_enable
|
2020-11-28 16:49:22 +01:00
|
|
|
#conf_HTTPS_CA
|
|
|
|
#conf_HTTPS_Cert
|
|
|
|
#conf_HTTPS_Key
|
|
|
|
#conf_HTTPS_Key_Pass
|
|
|
|
#conf_HTTPS_Port
|
|
|
|
#conf_HTTPS_Binding
|
|
|
|
#conf_HTTPS_Enable
|
2021-05-26 11:41:59 +02:00
|
|
|
#conf_debug_disable
|
|
|
|
#conf_Access_logfile
|
|
|
|
#conf_Access_logUUID
|
|
|
|
#conf_Error_logfile
|
|
|
|
#conf_Error_logUUID
|
2021-06-06 09:49:08 +02:00
|
|
|
#conf_Cache_logfile
|
|
|
|
#conf_Cache_logUUID
|
2023-03-29 10:40:17 +02:00
|
|
|
#conf_Debug_logUUID
|
2021-05-26 11:41:59 +02:00
|
|
|
#conf_runfile
|
2020-11-03 19:09:17 +01:00
|
|
|
EndEnumeration
|
|
|
|
|
2020-11-08 01:31:57 +01:00
|
|
|
Enumeration cli_handler 1
|
2020-11-03 19:09:17 +01:00
|
|
|
#handler_only ;Reagiert nur auf die Url (Bsp. /rest/v1/test aber nicht auf /rest/v1/test/sub)
|
|
|
|
#handler_sub ;Reagiert auf eine ganze Url die begint. (Bsp. /rest/v1/test sowie auch auf /rest/v1/test/sub)
|
2020-11-08 01:31:57 +01:00
|
|
|
#handler_type ;Reagiert auf datentypen (zb. *.php = "php")
|
2020-11-03 19:09:17 +01:00
|
|
|
EndEnumeration
|
|
|
|
|
2020-11-08 01:31:57 +01:00
|
|
|
Enumeration e_handler_prototype 1
|
2023-03-30 09:44:56 +02:00
|
|
|
#handler_proto_universal ;Used for Dynamic Librarys
|
|
|
|
#handler_proto_post ;Used for Dynamic Librarys
|
|
|
|
#handler_proto_get ;Used for Dynamic Librarys
|
|
|
|
#handler_proto_i_universal ;Used for internal Procedures
|
|
|
|
#handler_proto_i_post ;Used for internal Procedures
|
|
|
|
#handler_proto_i_get ;Used for internal Procedures
|
2020-11-08 01:31:57 +01:00
|
|
|
EndEnumeration
|
|
|
|
|
|
|
|
Enumeration cli_handler_app 1
|
|
|
|
#app_handler_map_string ;.s App(Requested.s, Map HandlerMap.s())
|
|
|
|
#app_handler_json ;.s App(Requested.s, JSONString.s)
|
|
|
|
#app_handler_string ;.s App(Requested.s, String.s)
|
|
|
|
#app_handler_ressource ;.s App(Requested.s)
|
|
|
|
EndEnumeration
|
|
|
|
|
|
|
|
#response_string = "response_string"
|
|
|
|
#response_Memory = "response_memory"
|
|
|
|
|
|
|
|
|
|
|
|
;cli_handler_app Return:
|
|
|
|
;Map.s() to JSONString
|
|
|
|
#cha_R_ResponseType = "ResponseType" ;Element ResponseType :Mimetype
|
|
|
|
#cha_R_ResponseContentType = "ResponseContentType" ;Element ResponseContentType :#response_string , #response_Memory
|
|
|
|
#cha_R_MemoryAdress = "MemoryAdress" ;Element MemoryAdress :Converted to String
|
|
|
|
#cha_R_MemorySize = "MemorySize" ;Element MemorySize :Converted to String
|
|
|
|
#cha_R_StringBase64 = "StringBase64" ;Element StringBase64 :Base64 Encoded String
|
2022-02-14 15:00:13 +01:00
|
|
|
#cha_R_http_head_status = "HeaderStatus" ;200 OK 300 Error 500 Server Error usw.
|
2020-11-03 19:09:17 +01:00
|
|
|
#error_string = "error"
|
2022-02-20 13:40:15 +01:00
|
|
|
#http_head_method = "method:"
|
|
|
|
#http_head_request = "request:"
|
|
|
|
#http_head_protocol = "protocol:"
|
|
|
|
#http_head_query = "query:"
|
|
|
|
#http_head_status = "status:"
|
2020-11-03 19:09:17 +01:00
|
|
|
#http_head_date = "date:"
|
|
|
|
#http_head_server = "server:"
|
|
|
|
#http_head_content_length = "content-length:"
|
|
|
|
#http_head_content_type = "content-type:"
|
|
|
|
#http_head_connection = "connection:"
|
|
|
|
#http_head_keep_alive = "keep-alive:"
|
2020-12-10 16:37:17 +01:00
|
|
|
#http_head_cookie = "cookie:"
|
|
|
|
#http_head_set_cookie = "set-cookie:"
|
2022-02-18 16:05:48 +01:00
|
|
|
#http_head_redirect = "location:"
|
2020-11-08 01:31:57 +01:00
|
|
|
|
|
|
|
#http_content_type_application_x_www_form_urlencoded = "application/x-www-form-urlencoded"
|
|
|
|
#http_content_type_multipart_form_data = "multipart/form-data"
|
|
|
|
|
2020-11-03 19:09:17 +01:00
|
|
|
Declare set_config(parameter.i=#conf_defaultfile, setting.s="index.html")
|
|
|
|
Declare.s get_config(parameter.i=#conf_defaultfile)
|
2023-03-29 10:40:17 +02:00
|
|
|
;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")
|
2023-03-29 20:06:01 +02:00
|
|
|
Declare.s register_client_handler(Route.s, Callback.i, AppPrototype.i = #handler_proto_get, RouteType.i = #handler_sub, Host.s = "")
|
2020-12-01 15:17:48 +01:00
|
|
|
|
|
|
|
XIncludeFile "inc/lweb_IP_header.pbi"
|
|
|
|
XIncludeFile "inc/lweb_helper_header.pbi"
|
2023-03-29 10:40:17 +02:00
|
|
|
XIncludeFile "inc/lweb_http_status_header.pbi"
|
|
|
|
|
2020-11-03 19:09:17 +01:00
|
|
|
EndDeclareModule
|