From d6450850c3f57b62819135f8975320427a618c78 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 22 Jan 2015 16:16:14 +0200 Subject: [PATCH] Add 405 (method not allowed) status Since the HttpServer class allows either GET or POST and returns 501 (not implemented) for others, programs using it may wish to further limit processing to GET requests only. --- source/http/status.cpp | 1 + source/http/status.h | 1 + 2 files changed, 2 insertions(+) diff --git a/source/http/status.cpp b/source/http/status.cpp index 6b95822..c5fdf96 100644 --- a/source/http/status.cpp +++ b/source/http/status.cpp @@ -14,6 +14,7 @@ ostream &operator<<(ostream &out, Status status) case BAD_REQUEST: out<<"Bad Request"; break; case FORBIDDEN: out<<"Forbidden"; break; case NOT_FOUND: out<<"Not Found"; break; + case METHOD_NOT_ALLOWED: out<<"Method not allowed"; break; case INTERNAL_ERROR: out<<"Internal Error"; break; case NOT_IMPLEMENTED: out<<"Not Implemented"; break; default: out<<"Unknown Status"; break; diff --git a/source/http/status.h b/source/http/status.h index 075016d..fe18a85 100644 --- a/source/http/status.h +++ b/source/http/status.h @@ -13,6 +13,7 @@ enum Status BAD_REQUEST = 400, FORBIDDEN = 403, NOT_FOUND = 404, + METHOD_NOT_ALLOWED = 405, INTERNAL_ERROR = 500, NOT_IMPLEMENTED = 501 }; -- 2.45.2