Software /
code /
prosody-modules
Changeset
1905:43fac0c2c772
mod_http_upload: Fix HEAD requests
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 13 Oct 2015 20:21:11 +0200 |
parents | 1904:5d84b7fbe3aa |
children | 1906:5849d70bcd37 |
files | mod_http_upload/mod_http_upload.lua |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua Sun Oct 11 19:32:49 2015 +0200 +++ b/mod_http_upload/mod_http_upload.lua Tue Oct 13 20:21:11 2015 +0200 @@ -112,14 +112,17 @@ end local serve_uploaded_files = module:depends("http_files").serve(storage_path); +local http_server = require"net.http.server"; -local function size_only(request, data) - request.headers.content_size = #data; - return 200; +local function size_only(response, data) + if data then + response.headers.content_size = #data; + end + return http_server.send_response(response); end local function serve_head(event, path) - event.send = size_only; + event.response.send = size_only; return serve_uploaded_files(event, path); end