acl/app/wizard_demo/httpd_proxy/http_servlet.h

35 lines
821 B
C
Raw Normal View History

#pragma once
2019-03-14 15:24:11 +08:00
class http_servlet : public acl::HttpServlet
{
public:
2022-01-24 18:36:08 +08:00
http_servlet(acl::socket_stream*, acl::session*, int port = 80);
2019-03-14 15:24:11 +08:00
~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:
2022-01-24 18:36:08 +08:00
int port_;
2019-03-14 15:24:11 +08:00
typedef bool (http_servlet::*handler_t)(request_t&,response_t&);
std::map<std::string, handler_t> handlers_;
2022-01-24 18:36:08 +08:00
bool on_hello(request_t&, response_t&);
2022-03-31 18:35:14 +08:00
bool transfer_get(request_t*, response_t*);
bool transfer_post(request_t*, response_t*);
2019-03-14 15:24:11 +08:00
2022-03-31 18:35:14 +08:00
bool transfer_tcp(acl::socket_stream* local, acl::socket_stream* peer);
2019-03-14 15:24:11 +08:00
};