9 static const char rcsid[] __attribute__((used)) =
"$Id: callbacks.cpp 1653 2016-02-28 19:54:59Z sella $";
11 #include "callbacks.h"
13 #include "../util/CommonMacro.h"
14 #include "../util/Log.h"
16 using namespace sella::server;
18 bool http::acl_callback(HTTPConnection::shared connection)
throw (ServerException) {
22 bool http::authentication_callback(HTTPConnection::shared connection)
throw (ServerException) {
26 bool http::request_callback(HTTPConnection::shared connection)
throw (ServerException) {
27 const HTTPRequest &request = connection->getRequest();
29 if (IS_TRACE(PACKAGE
"-detail")) {
33 switch (request.getMethod()) {
34 case HTTPRequest::Head:
35 connection->methodHead();
38 case HTTPRequest::Get:
39 connection->methodGet();
42 case HTTPRequest::Post:
43 connection->methodPost();
46 case HTTPRequest::Put:
47 connection->methodPut();
50 case HTTPRequest::Delete:
51 connection->methodDelete();
54 case HTTPRequest::Patch:
55 connection->methodPatch();
58 case HTTPRequest::Options:
59 connection->methodOptions();
62 case HTTPRequest::Trace:
63 connection->methodTrace();
66 case HTTPRequest::Connect:
67 connection->methodConnect();
71 THROW_CODE(ServerException, Code::NotImplemented,
"Requested method has not been implemented.");
77 bool http::error_callback(HTTPConnection::shared connection,
int code,
const std::string &detail)
throw (ServerException) {
78 TRACE(PACKAGE
"-detail",
"HTTP Error[%d]: %s", code, detail.c_str());
80 if (connection->isUsable()) {
81 connection->error(code, detail);