From: Alexis Laferrière Date: Thu, 21 Apr 2016 13:37:55 +0000 (-0400) Subject: lib/nitcorn: return a 404 on a request matching not routes or virtual host X-Git-Url: http://nitlanguage.org lib/nitcorn: return a 404 on a request matching not routes or virtual host Signed-off-by: Alexis Laferrière --- diff --git a/lib/nitcorn/reactor.nit b/lib/nitcorn/reactor.nit index d475444..de9ddc0 100644 --- a/lib/nitcorn/reactor.nit +++ b/lib/nitcorn/reactor.nit @@ -81,8 +81,8 @@ class HttpServer # Delegate the responsibility to respond to the `Action` handler.prepare_respond_and_close(request, turi, self) return - else response = new HttpResponse(405) - else response = new HttpResponse(405) + else response = new HttpResponse(404) + else response = new HttpResponse(404) respond response close diff --git a/tests/sav/test_nitcorn.res b/tests/sav/test_nitcorn.res index 4d2fb2c..49b4b8c 100644 --- a/tests/sav/test_nitcorn.res +++ b/tests/sav/test_nitcorn.res @@ -42,7 +42,7 @@ Method: GET, URI: /params_answer/0123/asdf/trailing/path, trailing: /trailing/pa Params args: i:0123, s:asdf [Client] curl -s localhost:*****/params_answer/0123 --head -HTTP/1.0 405 Method Not Allowed +HTTP/1.0 404 Not Found Content-Length: 0 Server: nitcorn Set-Cookie: nitcorn_session=; HttpOnly; expires=Thu, 01 Jan 1970 00:00:00 GMT @@ -118,7 +118,7 @@ Set-Cookie: nitcorn_session=; HttpOnly; expires=Thu, 01 Jan 1970 00:00:00 GMT [Client] curl -s localhost:*****/invalid_route --head -HTTP/1.0 405 Method Not Allowed +HTTP/1.0 404 Not Found Content-Length: 0 Server: nitcorn Set-Cookie: nitcorn_session=; HttpOnly; expires=Thu, 01 Jan 1970 00:00:00 GMT