lib/nitcorn: return a 404 on a request matching not routes or virtual host
authorAlexis Laferrière <alexis.laf@xymus.net>
Thu, 21 Apr 2016 13:37:55 +0000 (09:37 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Fri, 22 Apr 2016 18:41:17 +0000 (14:41 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/nitcorn/reactor.nit
tests/sav/test_nitcorn.res

index d475444..de9ddc0 100644 (file)
@@ -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
index 4d2fb2c..49b4b8c 100644 (file)
@@ -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\r
+HTTP/1.0 404 Not Found\r
 Content-Length: 0\r
 Server: nitcorn\r
 Set-Cookie: nitcorn_session=; HttpOnly; expires=Thu, 01 Jan 1970 00:00:00 GMT\r
@@ -118,7 +118,7 @@ Set-Cookie: nitcorn_session=; HttpOnly; expires=Thu, 01 Jan 1970 00:00:00 GMT
 \r
 
 [Client] curl -s localhost:*****/invalid_route --head
-HTTP/1.0 405 Method Not Allowed\r
+HTTP/1.0 404 Not Found\r
 Content-Length: 0\r
 Server: nitcorn\r
 Set-Cookie: nitcorn_session=; HttpOnly; expires=Thu, 01 Jan 1970 00:00:00 GMT\r