http_host.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "define.h"
  3. #if USE_NET_HTTP_WEBSITE
  4. #include "net/http_interface.h"
  5. namespace ylib
  6. {
  7. namespace network
  8. {
  9. namespace http
  10. {
  11. /******************************************************
  12. * class:域名器
  13. ******************************************************/
  14. class ssl;
  15. class host :public ylib::error_base, public network::http::interface_
  16. {
  17. public:
  18. host();
  19. ~host();
  20. void init(const std::string& host, ushort port, network::http::ssl* ssl = nullptr);
  21. inline network::http::ssl* ssl() { return m_ssl; }
  22. inline bool equal(const std::string& host) { return m_host == host; }
  23. inline const std::string& hostname() { return m_return_host; }
  24. inline const std::string& domain() { return m_host; }
  25. inline bool is_catchall() const { return m_catchall; }
  26. private:
  27. std::string m_host;
  28. std::string m_return_host;
  29. ushort m_port;
  30. network::http::ssl* m_ssl;
  31. bool m_catchall = false;
  32. };
  33. }
  34. }
  35. }
  36. #endif