# Post a Tnit!
var text = request.post_args["text"]
db.post(user, text)
+
+ # Redirect the user to avoid double posting
+ var response = new HttpResponse(303)
+ response.header["Location"] = request.uri
+ return response
end
end
var ext = local_file.file_extension
if ext != null then
var media_type = media_types[ext]
- if media_type != null then response.header["Content-Type"] = media_type
+ if media_type != null then
+ response.header["Content-Type"] = media_type
+ else response.header["Content-Type"] = "application/octet-stream"
end
file.close
types["asx"] = "video/x-ms-asf"
types["asf"] = "video/x-ms-asf"
types["mng"] = "video/x-mng"
+ types["apk"] = "application/vnd.android.package-archive"
end
end
end label
end
+ # Use default virtual host if none already responded
+ if virtual_host == null then virtual_host = factory.config.default_virtual_host
+
# Get a response from the virtual host
var response
if virtual_host != null then
# Server instance configuration
class ServerConfig
- # Virtual hosts list
+ # `VirtualHost`s served by this server
var virtual_hosts = new VirtualHosts(self)
- # TODO implement serialization or something like that
+ # Default `VirtualHost` to respond to requests not handled by any of the `virtual_hosts`
+ var default_virtual_host: nullable VirtualHost = null
end
# A `VirtualHost` configuration