#pragma once #include "http_define.h" #if USE_NET_HTTP_WEBSITE #include #include #include "http_session.h" #include "http_interface.h" namespace ylib { namespace network { namespace http { class reqpack; class server; /// /// HTTP请求 /// class request :public network::http::interface_ { public: request(network::http::reqpack* reqpack); ~request(); /// /// 取请求头 /// /// /// /// bool header(const std::string& name, std::string& value); /// /// 请求动作 /// /// std::string method(); /// /// 取请求路径 /// /// std::string filepath(); /// /// 取请求主机 /// /// std::string host(); /// /// session /// /// /// network::http::session& session(const std::string& session_id); network::http::reqpack* reqpack(); /// /// 远程信息 /// /// ylib::AddressPort remote(); /// /// 取请求参数 /// /// /// /// bool get_url_param(const std::string& name,std::string& value); bool get_body_param(const std::string& name, std::string& value); std::shared_ptr>& url_param() { return m_url_param; } std::shared_ptr>& body_param() { return m_body_param; } /// /// 表单数据 /// /// const std::shared_ptr>& multipart(); /// /// 是否为请求类型 /// /// bool content_type(std::string type_name); /// /// Body /// /// ylib::buffer& body(); private: // reqpack network::http::reqpack* m_reqpack = nullptr; // session network::http::session m_session; // 请求动作 std::string m_method; private: // 请求参数[URL] std::shared_ptr> m_url_param; // 请求参数[BODY] std::shared_ptr> m_body_param; // FORM数据 std::shared_ptr> m_form; }; } } } #endif