Changeset

9624:cc9dff0212f4 0.11

net.http.server: Move event formation to avoid traceback on missing Host header
author Matthew Wild <mwild1@gmail.com>
date Tue, 13 Nov 2018 15:03:24 +0000
parents 9622:269c6df1f0fb
children 9625:a7e0ed30f242 9626:4d3ab7153153
files net/http/server.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/server.lua	Mon Nov 12 22:49:54 2018 +0100
+++ b/net/http/server.lua	Tue Nov 13 15:03:24 2018 +0000
@@ -236,7 +236,6 @@
 				err_code, err = 400, "Missing or invalid 'Host' header";
 			end
 		end
-		local host_event = request.method.." "..host..request.path:match("[^?]*");
 
 		if err then
 			response.status_code = err_code;
@@ -244,6 +243,7 @@
 			return;
 		end
 
+		local host_event = request.method.." "..host..request.path:match("[^?]*");
 		log("debug", "Firing event: %s", host_event);
 		result = events.fire_event(host_event, payload);
 	end