| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #pragma once
- #include "http_define.h"
- #if USE_NET_HTTP_UTIL
- #include <functional>
- #include <map>
- #include <regex>
- #include "http_interface.h"
- #include "util/array.hpp"
- namespace ylib
- {
- namespace network
- {
- namespace http
- {
- class server;
- class router;
- class host;
- class agent;
- class website :public ylib::error_base, public network::http::interface_
- {
- public:
- public:
- website();
- ~website();
- /******************************************************************
- * function:启动
- * param
- * config : 配置项
- * return:
- * 失败可通过 last_error() 返回错误信息。
- ******************************************************************/
- bool start(const website_config& config);
- /******************************************************************
- * function:关闭
- ******************************************************************/
- void close();
- network::http::router* router();
- const website_config& config() { return m_config; }
- bool host(const std::string& host);
- bool is_catchall() const;
- ylib::nolock_array<network::http::proxy*>* proxy();
- private:
- // router路由 服务
- network::http::router* m_router = nullptr;
- // HOST
- std::vector<network::http::host*> m_hosts;
- // HTTPS
- bool m_https = false;
- // 反向代理
- ylib::nolock_array<network::http::proxy*> m_proxy;
- // 配置
- website_config m_config;
- };
- }
- }
- }
- #endif
|