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
|
|
|
|
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
|
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
|
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
|
|
|
|
#handler_proto_universal
|
|
|
|
#handler_proto_post
|
|
|
|
#handler_proto_get
|
|
|
|
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.
|
2020-11-03 19:09:17 +01:00
|
|
|
#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:"
|
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)
|
|
|
|
Declare start_server()
|
2020-11-08 01:31:57 +01:00
|
|
|
Declare.s register_client_handler(Route.s, Callback.i, AppPrototype.i = #handler_proto_get, RouteType.i = #handler_sub)
|
|
|
|
Declare.s mimetype(file.s)
|
2020-11-27 11:58:18 +01:00
|
|
|
Declare.s MapToJSONString(Map ConvertMap.s())
|
2020-11-03 19:09:17 +01:00
|
|
|
Declare IsIPStringValid(Adress.s)
|
|
|
|
|
|
|
|
EndDeclareModule
|