Changeset

3378:aefd64629e29

mod_http_upload: Relocate function definition to avoid traceback
author Matthew Wild <mwild1@gmail.com>
date Sun, 18 Nov 2018 12:16:47 +0000
parents 3377:683365d370d8
children 3379:f1c1f6bc4892
files mod_http_upload/mod_http_upload.lua
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Sun Nov 18 12:15:02 2018 +0000
+++ b/mod_http_upload/mod_http_upload.lua	Sun Nov 18 12:16:47 2018 +0000
@@ -230,6 +230,15 @@
 end
 
 -- http service
+local function set_cross_domain_headers(response)
+        local headers = response.headers;
+        headers.access_control_allow_methods = "GET, PUT, POST, OPTIONS";
+        headers.access_control_allow_headers = "Content-Type";
+        headers.access_control_max_age = "7200";
+        headers.access_control_allow_origin = response.request.headers.origin or "*";
+        return response;
+end
+
 local function upload_data(event, path)
 	set_cross_domain_headers(event.response);
 
@@ -286,15 +295,6 @@
 	end
 });
 
-local function set_cross_domain_headers(response)
-        local headers = response.headers;
-        headers.access_control_allow_methods = "GET, PUT, POST, OPTIONS";
-        headers.access_control_allow_headers = "Content-Type";
-        headers.access_control_max_age = "7200";
-        headers.access_control_allow_origin = response.request.headers.origin or "*";
-        return response;
-end
-
 local function send_response_sans_body(response, body)
 	if response.finished then return; end
 	response.finished = true;