changeset 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
parents 0a0bf87ccda6
children 04ff0de40ba9
files mod_http_upload/mod_http_upload.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Sat Oct 12 16:22:54 2019 +0200
+++ b/mod_http_upload/mod_http_upload.lua	Sat Oct 12 19:42:37 2019 +0200
@@ -17,6 +17,7 @@
 local t_concat = table.concat;
 local t_insert = table.insert;
 local s_upper = string.upper;
+local httpserver = require "net.http.server";
 local have_id, id = pcall(require, "util.id"); -- Only available in 0.10+
 local uuid = require"util.uuid".generate;
 if have_id then
@@ -383,6 +384,11 @@
 	return serve_uploaded_files(event, path);
 end
 
+if httpserver.send_head_response then
+	-- Prosody will take care of HEAD requests since hg:3f4c25425589
+	serve_head = nil
+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.." on "..module.host.."!</h1>\n";