lweb/inc/lweb_helper.pbi
Ground0 2cbfdceaac Splittet source up to some includes.
Every Include should now have some procedure who are standalone usable.

lweb_http Has a lot of changes todo (Full HTTP 1.1 Compliance)
lweb_file_cache, is realy buggy. A lot of todo's
lweb_IP is Only IsIPStringValid in
lweb_helper, there is only some help procedures.

To Do:
lweb_http_post (Everything Post Specific)
lweb_http_get  (Everything Get Specific)
lweb_http_put  (Complete todo nothing done until now)
lweb_server_http (Specific http only Server)
lweb_server_https (Specific https only Server)
lweb_server (Common Server Things)

Maybe everything more generic to use standalone...
2020-12-01 15:17:48 +01:00

45 lines
No EOL
999 B
Text

;********************************
;*
;* lweb_helper.pbi
;*
Procedure.s mimetype(file.s)
Select file
Case "png"
ProcedureReturn "image/png"
Case "gif"
ProcedureReturn "image/gif"
Case "jpg"
ProcedureReturn "image/jpeg"
Case "jpeg"
ProcedureReturn "image/jpeg"
Case "txt"
ProcedureReturn "text/plain"
Case "html"
ProcedureReturn "text/html"
Case "htm"
ProcedureReturn "text/html"
Case "mss"
ProcedureReturn "text/html"
Case "css"
ProcedureReturn "text/css"
Case "js"
ProcedureReturn "text/javascript"
Default
ProcedureReturn "text/html"
EndSelect
EndProcedure
Procedure.s MapToJSONString(Map ConvertMap.s())
Protected MyJSON
Protected.s Response
MyJSON = CreateJSON(#PB_Any)
If MyJSON
InsertJSONMap(JSONValue(MyJSON), ConvertMap())
Response = ComposeJSON(MyJSON)
FreeJSON(MyJSON)
ProcedureReturn Response
EndIf
ProcedureReturn #error_string
EndProcedure