Comparison

net/http/server.lua @ 4739:f1d32a0dc057

net.http.server: Fix traceback on missing host header (thanks darkrain)
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Apr 2012 00:51:36 +0100
parent 4736:3514338c59c3
child 4740:bd9c8bc8036f
comparison
equal deleted inserted replaced
4738:e95458712782 4739:f1d32a0dc057
176 local err_code, err; 176 local err_code, err;
177 if not host then 177 if not host then
178 err_code, err = 400, "Missing or invalid 'Host' header"; 178 err_code, err = 400, "Missing or invalid 'Host' header";
179 elseif not request.path then 179 elseif not request.path then
180 err_code, err = 400, "Invalid path"; 180 err_code, err = 400, "Invalid path";
181 end 181 elseif not hosts[host] then
182 if not hosts[host] then
183 if hosts[default_host] then 182 if hosts[default_host] then
184 host = default_host; 183 host = default_host;
185 else 184 else
186 err_code, err = 404, "Unknown host: "..host; 185 err_code, err = 404, "Unknown host: "..host;
187 end 186 end