Mercurial > prosody-modules
comparison mod_http_upload/mod_http_upload.lua @ 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 | b01d60dfa405 |
| children | 3b748666ff97 |
comparison
equal
deleted
inserted
replaced
| 1941:2a5a44d5b935 | 1942:ff95d983940c |
|---|---|
| 159 local function serve_head(event, path) | 159 local function serve_head(event, path) |
| 160 event.response.send = send_response_sans_body; | 160 event.response.send = send_response_sans_body; |
| 161 return serve_uploaded_files(event, path); | 161 return serve_uploaded_files(event, path); |
| 162 end | 162 end |
| 163 | 163 |
| 164 local function serve_hello(event) | |
| 165 event.response.headers.content_type = "text/html;charset=utf-8" | |
| 166 return "<!DOCTYPE html>\n<h1>Hello from mod_"..module.name.."!</h1>\n"; | |
| 167 end | |
| 168 | |
| 164 module:provides("http", { | 169 module:provides("http", { |
| 165 route = { | 170 route = { |
| 171 ["GET"] = serve_hello; | |
| 172 ["GET /"] = serve_hello; | |
| 166 ["GET /*"] = serve_uploaded_files; | 173 ["GET /*"] = serve_uploaded_files; |
| 167 ["HEAD /*"] = serve_head; | 174 ["HEAD /*"] = serve_head; |
| 168 ["PUT /*"] = upload_data; | 175 ["PUT /*"] = upload_data; |
| 169 }; | 176 }; |
| 170 }); | 177 }); |
