Changeset

1942:ff95d983940c

mod_http_upload: Say Hello to anyone opening the "bare" HTTP URL (helpful to show that module is loaded correctly)
author Kim Alvefur <zash@zash.se>
date Sun, 01 Nov 2015 18:12:49 +0100
parents 1941:2a5a44d5b935
children 1943:7e04ca0aa757
files mod_http_upload/mod_http_upload.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Fri Oct 30 17:47:48 2015 +0100
+++ b/mod_http_upload/mod_http_upload.lua	Sun Nov 01 18:12:49 2015 +0100
@@ -161,8 +161,15 @@
 	return serve_uploaded_files(event, path);
 end
 
+local function serve_hello(event)
+	event.response.headers.content_type = "text/html;charset=utf-8"
+	return "<!DOCTYPE html>\n<h1>Hello from mod_"..module.name.."!</h1>\n";
+end
+
 module:provides("http", {
 	route = {
+		["GET"] = serve_hello;
+		["GET /"] = serve_hello;
 		["GET /*"] = serve_uploaded_files;
 		["HEAD /*"] = serve_head;
 		["PUT /*"] = upload_data;