lweb/build_tools/src/status_xml_export.pb

125 lines
No EOL
4.8 KiB
Text

OpenConsole("Write Default HTTP Status Code XML Server")
PrintN("Create default_http_status_codes.xml...")
Enumeration http_header_fieldtype
#http_header_field_Static ;Fieldcontent could be directly used
#http_header_field_Dynamic_auto ;Must be handled by the Fieldcontent_proc
EndEnumeration
Enumeration http_headerfield_param
#http_headerfield_param_string
#http_headerfield_param_map
#http_headerfield_param_integer
EndEnumeration
Structure http_headerfield_params
Type.i ;Types of Field #Content or #Map
Content_string.s ;String Field
Map Content_Maps.s() ;Map Field
Content_integer.i ;Integer Field
EndStructure
Structure http_headerfield
Fieldname.s ; Name bevore : for ex. "keep-alive:"
Fieldcontent.s ; Content after : for ex. "Keep-Alive"
Fieldcontent_type.i ; #http_header_field_Static or #http_header_field_Dynamic_auto
Fieldcontent_proc.i ; A Procedure Prototype to call
Map Field_proc_parameters.http_headerfield_params() ;Parameters to give to call
EndStructure
Structure http_status_codes
status.s ;Error Number
file.s ;Error File or "Integrated" for default Message as Template
header.s ;Error Header message for #http_head_status
message.s ;Error Message for Templated
message_body.s ;Error Message Body for Templated
template.b ;Is it a Template {ErrorNo}=error and {Message}=message and {Message_body}=message_body need to be there
content.b ;has it a content to send. (200 for ex. has no content who need to be processed.)
Map head_fields.http_headerfield()
EndStructure
Structure config
Map status.http_status_codes()
EndStructure
Global configuration.config
configuration\status("200")\status = "200"
configuration\status("200")\file = ""
configuration\status("200")\header = "200 Ok"
configuration\status("200")\message = ""
configuration\status("200")\template = #False
configuration\status("200")\content = #False
;3xx
configuration\status("303")\status = "303"
configuration\status("303")\file = ""
configuration\status("303")\header = "303 See Other"
configuration\status("303")\message = ""
configuration\status("303")\template = #False
configuration\status("303")\content = #False
;4xx
configuration\status("400")\status = "400"
configuration\status("400")\file = "integrated"
configuration\status("400")\header = "400 Bad Request"
configuration\status("400")\message = "400 Bad Request"
configuration\status("400")\template = #True
configuration\status("400")\content = #True
configuration\status("403")\status = "403"
configuration\status("403")\file = "integrated"
configuration\status("403")\header = "403 Forbidden"
configuration\status("403")\message = "403 Forbidden"
configuration\status("403")\template = #True
configuration\status("403")\content = #True
configuration\status("404")\status = "404"
configuration\status("404")\file = "integrated"
configuration\status("404")\header = "404 Not Found"
configuration\status("404")\message = "404 Not Found"
configuration\status("404")\template = #True
configuration\status("404")\content = #True
;5xx
configuration\status("500")\status = "500"
configuration\status("500")\file = "integrated"
configuration\status("500")\header = "500 Internal Server Error"
configuration\status("500")\message = "500 Internal Server Error"
configuration\status("500")\template = #True
configuration\status("500")\content = #True
configuration\status("501")\status = "501"
configuration\status("501")\file = "integrated"
configuration\status("501")\header = "501 Not Implemented"
configuration\status("501")\message = "501 Not Implemented"
configuration\status("501")\template = #True
configuration\status("501")\content = #True
configuration\status("502")\status = "502"
configuration\status("502")\file = "integrated"
configuration\status("502")\header = "502 Bad Gateway"
configuration\status("502")\message = "502 Bad Gateway"
configuration\status("502")\template = #True
configuration\status("502")\content = #True
configuration\status("503")\status = "503"
configuration\status("503")\file = "integrated"
configuration\status("503")\header = "503 Service Unavailable"
configuration\status("503")\message = "503 Service Unavailable"
configuration\status("503")\template = #True
configuration\status("503")\content = #True
If CreateXML(0)
InsertXMLMap(RootXMLNode(0), configuration\status())
FormatXML(0, #PB_XML_ReFormat)
ToSave.s = ComposeXML(0)
EndIf
CreateFile(0, "default_http_status_codes.xml")
WriteString(0, ToSave)
PrintN("Default status codes xml created: default_http_status_codes.xml")
End