Software /
code /
prosody-modules
Comparison
mod_http_upload/mod_http_upload.lua @ 3713:53fc4b612fb2
mod_http_upload: Skip custom HEAD handling on recent Prosody trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 12 Oct 2019 19:42:37 +0200 |
parent | 3661:88d414c916ee |
child | 3961:6fd9c9708422 |
comparison
equal
deleted
inserted
replaced
3712:0a0bf87ccda6 | 3713:53fc4b612fb2 |
---|---|
15 local datamanager = require "util.datamanager"; | 15 local datamanager = require "util.datamanager"; |
16 local array = require "util.array"; | 16 local array = require "util.array"; |
17 local t_concat = table.concat; | 17 local t_concat = table.concat; |
18 local t_insert = table.insert; | 18 local t_insert = table.insert; |
19 local s_upper = string.upper; | 19 local s_upper = string.upper; |
20 local httpserver = require "net.http.server"; | |
20 local have_id, id = pcall(require, "util.id"); -- Only available in 0.10+ | 21 local have_id, id = pcall(require, "util.id"); -- Only available in 0.10+ |
21 local uuid = require"util.uuid".generate; | 22 local uuid = require"util.uuid".generate; |
22 if have_id then | 23 if have_id then |
23 uuid = id.medium; | 24 uuid = id.medium; |
24 end | 25 end |
381 event.response.send = send_response_sans_body; | 382 event.response.send = send_response_sans_body; |
382 event.response.send_file = send_response_sans_body; | 383 event.response.send_file = send_response_sans_body; |
383 return serve_uploaded_files(event, path); | 384 return serve_uploaded_files(event, path); |
384 end | 385 end |
385 | 386 |
387 if httpserver.send_head_response then | |
388 -- Prosody will take care of HEAD requests since hg:3f4c25425589 | |
389 serve_head = nil | |
390 end | |
391 | |
386 local function serve_hello(event) | 392 local function serve_hello(event) |
387 event.response.headers.content_type = "text/html;charset=utf-8" | 393 event.response.headers.content_type = "text/html;charset=utf-8" |
388 return "<!DOCTYPE html>\n<h1>Hello from mod_"..module.name.." on "..module.host.."!</h1>\n"; | 394 return "<!DOCTYPE html>\n<h1>Hello from mod_"..module.name.." on "..module.host.."!</h1>\n"; |
389 end | 395 end |
390 | 396 |