diff options
-rw-r--r-- | includes/Http.h | 3 | ||||
-rw-r--r-- | src/HttpServer.cc | 26 |
2 files changed, 28 insertions, 1 deletions
diff --git a/includes/Http.h b/includes/Http.h index 26323ee..8b0e313 100644 --- a/includes/Http.h +++ b/includes/Http.h @@ -33,6 +33,9 @@ enum { TRACE, OPTIONS, CONNECT, + BREW, + PROPFIND, + WHEN, REDIRECT = 301, diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 1268c7b..a00160f 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -57,6 +57,10 @@ class HttpWorker : public Task { extra.push_back("Allow: GET, POST"); sendError(405, "The HTTP request you've sent contains an unsupported method.", NULL, true, extra, d); } + void send418() { + std::vector<String> d; + sendError(418, "Short and stout. Here is my handle, here is my spout.", NULL, true, d, d); + } void send500(const char * msg, const char * details, std::vector<String> trace) { String smsg; std::vector<String> d; @@ -286,6 +290,9 @@ bool Balau::HttpWorker::handleClient() { } else if ((line[1] == 'U') && (line[2] == 'T') && (line[3] == ' ')) { urlBegin = 4; method = Http::PUT; + } else if ((line[1] == 'R') && (line[2] == 'O') && (line[3] == 'P') && (line[4] == 'F') && (line[5] == 'I') && (line[6] == 'N') && (line[7] == 'D') && (line[8] == ' ')) { + urlBegin = 9; + method = Http::PROPFIND; } break; case 'D': @@ -312,6 +319,18 @@ bool Balau::HttpWorker::handleClient() { method = Http::CONNECT; } break; + case 'B': + if ((line[1] == 'R') && (line[2] == 'E') && (line[3] == 'W') && (line[4] == ' ')) { + urlBegin = 5; + method = Http::BREW; + } + break; + case 'W': + if ((line[1] == 'H') && (line[2] == 'E') && (line[3] == 'N') && (line[4] == ' ')) { + urlBegin = 5; + method = Http::WHEN; + } + break; } if (urlBegin == 0) { Balau::Printer::elog(Balau::E_HTTPSERVER, "%s didn't get a URI after the method", m_name.to_charp()); @@ -380,7 +399,12 @@ bool Balau::HttpWorker::handleClient() { send400(); return false; } - + + if (method == Http::BREW) { + send418(); + return false; + } + if ((method != Http::GET) && (method != Http::POST)) { send405(); return false; |