#pragma once #include "http_define.h" #if USE_NET_HTTP_WEBSITE #include "http_server.h" #include "http_interface.h" #include "util/strutils.h" #include "util/time.h" namespace ylib { namespace network { namespace http { class server; class response; class request; class website; /// /// 请求包 /// class reqpack:public network::http::interface_ { public: /// /// 构造函数 /// /// /// /// /// /// /// reqpack(const std::string& url, const std::string& host, const ylib::buffer& data, uint64 connid, network::http::server* server,network::http::website* website); ~reqpack(); /// /// 请求对象 /// /// const std::shared_ptr& request(); /// /// 回复对象 /// /// const std::shared_ptr& response(); /// /// httpserver /// /// network::http::server* server() { return m_server; } /// /// 连接ID /// /// uint64 connid() { return m_connid; } /// /// 请求完整URL /// /// std::string url() { return m_url; } /// /// 请求路径 /// /// std::string filepath() { return m_filepath; } /// /// 请求主机 /// /// std::string host() { return m_host; } /// /// 请求数据 /// /// ylib::buffer& body() { return m_data; } /// /// 附加数据 /// /// ylib::json& extra() { return m_extra; } private: // 请求 std::shared_ptr m_request; // 回复 std::shared_ptr m_response; // httpserver network::http::server* m_server = nullptr; // 请求地址 std::string m_url; // 请求路径 std::string m_filepath; // 请求主机 std::string m_host; // 请求数据 ylib::buffer m_data; // 请求ID uint64 m_connid = 0; // 附加数据 ylib::json m_extra; }; } } } #endif