diff --git a/lhs_lib b/lhs_lib index 606f515..7ab2255 160000 --- a/lhs_lib +++ b/lhs_lib @@ -1 +1 @@ -Subproject commit 606f5159d4c3e4c2c9b0c9c6a0f88550cca89951 +Subproject commit 7ab2255ff01ce1417093e4e12c8b5e844324c556 diff --git a/lweb.pbi b/lweb.pbi index 2d78008..950f066 100644 --- a/lweb.pbi +++ b/lweb.pbi @@ -47,10 +47,16 @@ Module lhs_web enable.i EndStructure + Structure log_config + Accesslog.s + Errorlog.s + EndStructure + Structure server http.server_http https.server_https cache.server_cache + log.log_config version.s identifikation.s defaultfile.s @@ -236,6 +242,10 @@ Module lhs_web Procedure set_config(parameter.i=#conf_defaultfile, setting.s="index.html") Select parameter + Case #conf_log_Accesslog + configuration\log\Accesslog = setting + Case #conf_log_Errorlog + configuration\log\Errorlog = setting Case #conf_HTTP_port configuration\http\port = Val(setting) Case #conf_HTTPS_Port @@ -544,6 +554,15 @@ Module lhs_web ;lhs_log::Out("JSONString:"+ JSONStringToMap) thread_type = "" + If configuration\log\Accesslog <> "" + If m_clients(Str(thread_cli_id))\client_type = #client_HTTPS + lhs_log_ext::Out(configuration\log\Accesslog, lsocket::GetSocketIP(ltls::GetSocket(thread_cli_id)) + " " + Header(#http_head_method) + " " + Header(#http_head_request)) + Else + lhs_log_ext::Out(configuration\log\Accesslog, lsocket::GetSocketIP(thread_cli_id) + " " + Header(#http_head_method) + " " + Header(#http_head_request)) + EndIf + + EndIf + Select Header(#http_head_method) Case #http_method_get ;******************************** diff --git a/lweb.pbp b/lweb.pbp index 557915d..c17b398 100644 --- a/lweb.pbp +++ b/lweb.pbp @@ -8,12 +8,12 @@
- +
- - + + @@ -29,7 +29,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -65,15 +65,15 @@ - + - + - +
@@ -83,12 +83,14 @@ + +
diff --git a/lweb_header.pbi b/lweb_header.pbi index ed7d4d5..391cae0 100644 --- a/lweb_header.pbi +++ b/lweb_header.pbi @@ -39,6 +39,8 @@ DeclareModule lhs_web #conf_HTTPS_Port #conf_HTTPS_Binding #conf_HTTPS_Enable + #conf_log_Errorlog + #conf_log_Accesslog EndEnumeration Enumeration cli_handler 1 diff --git a/server_example.pb b/server_example.pb index e76b3a8..9695daf 100644 --- a/server_example.pb +++ b/server_example.pb @@ -24,7 +24,7 @@ XIncludeFile "lweb.pbi" ;* Define counter, v_lweb_srv_stop -Define Accesslog.s +Define Accesslog.s, Errorlog.s ;* ;* Basic Debug Log initialization: @@ -41,16 +41,26 @@ lhs_log::Init() ;* Enable extended Logging: ;* Accesslog = lhs_log_ext::Create("Accesslog") +Errorlog = lhs_log_ext::Create("Errorlog") +lhs_log::Out("Errorlog UUID:"+Errorlog) +lhs_log::Out("Accesslog UUID:"+Accesslog) +lhs_log_ext::SetLogFile(Accesslog, "http-s_access.log") +lhs_log_ext::SetLogFile(Errorlog, "http-s_error.log") +lhs_log_ext::Init(Accesslog) +lhs_log_ext::Init(Errorlog) -lhs_web::set_config(lhs_web::#conf_HTTP_port, "8081") +lhs_web::set_config(lhs_web::#conf_log_Accesslog, Accesslog) +lhs_web::set_config(lhs_web::#conf_log_Errorlog, ErrorLog) + +lhs_web::set_config(lhs_web::#conf_HTTP_port, "8084") ;lhs_web::set_config(lhs_web::#conf_binding, "127.0.0.1") lhs_web::set_config(lhs_web::#conf_HTTP_binding, "0.0.0.0") lhs_web::set_config(lhs_web::#conf_HTTPS_CA, "fullchain.pem") lhs_web::set_config(lhs_web::#conf_HTTPS_Cert, "cert.pem") lhs_web::set_config(lhs_web::#conf_HTTPS_Key, "privkey.pem") lhs_web::set_config(lhs_web::#conf_HTTPS_Key_Pass, "") -lhs_web::set_config(lhs_web::#conf_HTTPS_Binding, "127.0.0.1") -lhs_web::set_config(lhs_web::#conf_HTTPS_Port, "8444") +lhs_web::set_config(lhs_web::#conf_HTTPS_Binding, "0.0.0.0") +lhs_web::set_config(lhs_web::#conf_HTTPS_Port, "8446") lhs_web::set_config(lhs_web::#conf_HTTPS_Enable, "1") lhs_web::set_config(lhs_web::#conf_defaultfile, "/index.html") lhs_web::set_config(lhs_web::#conf_basedir, "/home/renlin/testweb/") @@ -180,6 +190,8 @@ PrintN("HTTP an Port:"+lhs_web::get_config(lhs_web::#conf_HTTP_port)) PrintN("HTTPS an Port:"+lhs_web::get_config(lhs_web::#conf_HTTPS_Port)) PrintN("Press Enter to Exit") Input() -PrintN("Finished") lhs_log::Close() +lhs_log_ext::StopAllLogger() +PrintN("Finished") + End