acl/lib_acl_cpp/samples/websocket/upload_server/http_servlet.h
zsx 66a560e37f fixed bugs in client_wakeup of acl_threads_server.c;
acl::fiber_tbox and acl::fiber_cond are ok.
2018-12-06 15:50:13 +08:00

44 lines
1.2 KiB
C++

#pragma once
class http_servlet : public acl::HttpServlet
{
public:
http_servlet(acl::redis_client_cluster& cluster, size_t max_conns);
~http_servlet();
acl::session& get_session() const
{
return *session_;
}
protected:
// @override
bool doError(acl::HttpServletRequest&, acl::HttpServletResponse&);
// @override
bool doUnknown(acl::HttpServletRequest&, acl::HttpServletResponse&);
// @override
bool doGet(acl::HttpServletRequest&, acl::HttpServletResponse&);
// @override
bool doPost(acl::HttpServletRequest&, acl::HttpServletResponse&);
// @override
bool doWebSocket(acl::HttpServletRequest&, acl::HttpServletResponse&);
private:
acl::session* session_;
bool doPing(acl::websocket&, acl::websocket&);
bool doPong(acl::websocket&, acl::websocket&);
bool doClose(acl::websocket&, acl::websocket&);
bool doMsg(acl::websocket&, acl::websocket&);
bool getFilename(acl::websocket&, acl::string&);
long long getFilesize(acl::websocket& in);
bool saveFile(acl::websocket&, const acl::string&, long long);
bool saveFile(acl::websocket&, acl::ofstream&, long long);
int saveFile(acl::websocket&, acl::ofstream&);
};