2019-07-28 10:31:56 +08:00
|
|
|
#pragma once
|
2019-03-14 15:24:11 +08:00
|
|
|
|
|
|
|
class http_servlet : public acl::HttpServlet
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
http_servlet(acl::socket_stream*, acl::session*);
|
|
|
|
~http_servlet();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// @override
|
|
|
|
bool doGet(request_t&, response_t&);
|
|
|
|
|
|
|
|
// @override
|
|
|
|
bool doPost(request_t&, response_t&);
|
|
|
|
|
|
|
|
// @override
|
|
|
|
bool doError(request_t&, response_t&);
|
|
|
|
|
|
|
|
// @override
|
|
|
|
bool doOther(request_t&, response_t&, const char* method);
|
|
|
|
|
|
|
|
bool doConnect(request_t&, response_t&);
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef bool (http_servlet::*handler_t)(request_t&,response_t&);
|
|
|
|
std::map<std::string, handler_t> handlers_;
|
|
|
|
|
2022-01-19 23:47:53 +08:00
|
|
|
bool onDefault(request_t&, response_t&);
|
|
|
|
bool onHello(request_t&, response_t&);
|
2019-03-14 15:24:11 +08:00
|
|
|
|
2022-01-19 23:47:53 +08:00
|
|
|
bool doTcpProxy(acl::socket_stream& local, acl::socket_stream& peer);
|
2019-03-14 15:24:11 +08:00
|
|
|
};
|