diff options
author | Pixel <pixel@nobis-crew.org> | 2011-12-13 21:51:37 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-12-13 21:51:37 -0800 |
commit | f191c6f606fe15f2a99b850aabe65c11f884e289 (patch) | |
tree | 1f53b99e5c19591894445a2f16f7d76e6c286cbf /src | |
parent | 96be50597d948d8bfa5adb2dc0204bbc3b61b1dd (diff) |
Better implementation of RFC 2324.
Diffstat (limited to 'src')
-rw-r--r-- | src/HttpServer.cc | 26 |
1 files changed, 25 insertions, 1 deletions
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; |