;******************************** ;* ;* lweb_header.pbi ;* ;* LiHaSo Webserver Modul Header/Declare ;* ;* It is usable as standalone Webserver, look at lwebd.pb ;* ;* ;* EnableExplicit XIncludeFile "lhs_lib/NET/lhs_web_helper.pbi" CompilerIf #PB_Compiler_Thread = 0 CompilerError "Muss Threadsicher Kompiliert werden" CompilerEndIf DeclareModule lhs_web ;******************************** ;* ;* Proceduren Deklarierung ;* Enumeration e_conf #conf_HTTP_port #conf_HTTP_binding #conf_defaultfile #conf_basedir #conf_error400 #conf_max_HTTP_clients #conf_max_HTTPS_clients #conf_File_max_in_Memory #conf_File_BlockSize #conf_server_type #conf_cache_enable #conf_HTTPS_CA #conf_HTTPS_Cert #conf_HTTPS_Key #conf_HTTPS_Key_Pass #conf_HTTPS_Port #conf_HTTPS_Binding #conf_HTTPS_Enable #conf_debug_disable #conf_Access_logfile #conf_Access_logUUID #conf_Error_logfile #conf_Error_logUUID #conf_Cache_logfile #conf_Cache_logUUID #conf_Debug_logUUID #conf_runfile EndEnumeration Enumeration cli_handler 1 #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) #handler_type ;Reagiert auf datentypen (zb. *.php = "php") EndEnumeration Enumeration e_handler_prototype 1 #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 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 #cha_R_http_head_status = "HeaderStatus" ;200 OK 300 Error 500 Server Error usw. #error_string = "error" #http_head_method = "method:" #http_head_request = "request:" #http_head_protocol = "protocol:" #http_head_query = "query:" #http_head_status = "status:" #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:" #http_head_cookie = "cookie:" #http_head_cookie_set = "set-cookie:" #http_head_redirect = "location:" #http_content_type_application_x_www_form_urlencoded = "application/x-www-form-urlencoded" #http_content_type_multipart_form_data = "multipart/form-data" Declare set_config(parameter.i=#conf_defaultfile, setting.s="index.html") Declare.s get_config(parameter.i=#conf_defaultfile) ;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, Host.s = "") XIncludeFile "inc/lweb_IP_header.pbi" XIncludeFile "inc/lweb_helper_header.pbi" XIncludeFile "inc/lweb_http_status_header.pbi" EndDeclareModule