66 lines
2.3 KiB
Text
66 lines
2.3 KiB
Text
|
;****************************
|
||
|
;*
|
||
|
;* Lihaso Web Server (lhttpd)
|
||
|
;*
|
||
|
;* (c)2020 by Linder Hard- und Software
|
||
|
;*
|
||
|
;* V0.5
|
||
|
;* - Simple webserver for HTTP & HTTPS
|
||
|
;*
|
||
|
|
||
|
EnableExplicit
|
||
|
|
||
|
;*
|
||
|
;* Variable Declaration.
|
||
|
;*
|
||
|
|
||
|
XIncludeFile "lweb_header.pbi"
|
||
|
XIncludeFile "lweb.pbi"
|
||
|
|
||
|
OpenConsole("Test")
|
||
|
|
||
|
If OpenPreferences("lhttpd.ini", #PB_Preference_GroupSeparator)
|
||
|
If PreferenceGroup("lhttpd")
|
||
|
lhs_web::set_config(lhs_web::#conf_port, ReadPreferenceString("HTTP_Port","8081"))
|
||
|
lhs_web::set_config(lhs_web::#conf_binding, ReadPreferenceString("HTTP_Binding","0.0.0.0"))
|
||
|
lhs_web::set_config(lhs_web::#conf_HTTPS_CA, ReadPreferenceString("HTTPS_CA","/home/renlin/dev/libressl/sample/test_ca.pem"))
|
||
|
lhs_web::set_config(lhs_web::#conf_HTTPS_Cert, ReadPreferenceString("HTTPS_Cert","/home/renlin/dev/libressl/sample/test_server_cert.pem"))
|
||
|
lhs_web::set_config(lhs_web::#conf_HTTPS_Key, ReadPreferenceString("HTTPS_Key","/home/renlin/dev/libressl/sample/test_server_key.pem"))
|
||
|
lhs_web::set_config(lhs_web::#conf_HTTPS_Key_Pass, ReadPreferenceString("HTTPS_Key_Pass","test-server-pass"))
|
||
|
lhs_web::set_config(lhs_web::#conf_HTTPS_Port, ReadPreferenceString("HTTPS_Port","8444"))
|
||
|
lhs_web::set_config(lhs_web::#conf_HTTPS_Binding, ReadPreferenceString("HTTPS_Binding","127.0.0.1"))
|
||
|
lhs_web::set_config(lhs_web::#conf_HTTPS_Enable, ReadPreferenceString("HTTPS_enable","0"))
|
||
|
lhs_web::set_config(lhs_web::#conf_defaultfile, ReadPreferenceString("Defaultfile","/index.html"))
|
||
|
lhs_web::set_config(lhs_web::#conf_basedir, ReadPreferenceString("Basedirectory","/home/renlin/testweb/"))
|
||
|
lhs_web::set_config(lhs_web::#conf_error400, ReadPreferenceString("Error400_Handling","integrated"))
|
||
|
lhs_web::set_config(lhs_web::#conf_max_clients, ReadPreferenceString("MaxClients","100"))
|
||
|
lhs_web::set_config(lhs_web::#conf_cache_enable, ReadPreferenceString("Filememorycache","0"))
|
||
|
ClosePreferences()
|
||
|
Else
|
||
|
PrintN("No correct config file -> End")
|
||
|
End
|
||
|
EndIf
|
||
|
Else
|
||
|
PrintN("Could not open config file.")
|
||
|
EndIf
|
||
|
|
||
|
;*
|
||
|
;* includes
|
||
|
;*
|
||
|
|
||
|
If lhs_web::start_server()
|
||
|
Debug "Server gestartet" + lhs_web::get_config(lhs_web::#conf_port)
|
||
|
Else
|
||
|
Debug "Fehlgeschlagen"
|
||
|
End
|
||
|
EndIf
|
||
|
|
||
|
PrintN("Webserver")
|
||
|
PrintN("HTTP an Port:"+lhs_web::get_config(lhs_web::#conf_port))
|
||
|
PrintN("HTTPS an Port:"+lhs_web::get_config(lhs_web::#conf_HTTPS_Port))
|
||
|
PrintN("Press Enter to Exit")
|
||
|
Input()
|
||
|
|
||
|
|
||
|
End
|