Loads mime types from a file. Returns false if file not found.
// Example mime file
text/html html htm shtml
text/css css
Returns the mime type for the given file.
Defaults to "text/plain"
Sets the responses body to the files data and sets the correct Content-Type
header.
Takes an array of routes to server.
paths := {}
paths["/"] := Func("SomeFunction")
SomeFunction(ByRef request, ByRef response, ByRef server) {
response.SetBodyText("Hello World")
response.status := 200
}
Starts the http server on the specified port.
Used internally to handle requests.
Array containing headers from request.
request.headers["Some-Header"]
Array containing queries from request.
; request -> /dog?name=frank
msgbox % request.queries["name"] ; will display frank
The path being requested.
request.path
Method of request.
request.method
Protocol of request.
request.protocol
Returns true if the request is a multipart request.
MultiPart(ByRef req, ByRef res) {
if (req.IsMultipart() && !req.done)
res.status := 100
return
}
msgbox % req.body
res.status := 200
}
Whether or not a multipart request is done being sent.
Array containing headers for response.
response.headers["Date"] := "Today"
Protocol of response.
response.protocol
Sets the responses body.
body - data for body of response
length - length of data
Sets the responses body as text.
Returns a buffer that contains the responses data.