Bredbandskollen CLI  1.2
Asynchronous network task engine
httphost.h
1 // Copyright (c) 2017 IIS (The Internet Foundation in Sweden)
2 // Written by Göran Andersson <goran@init.se>
3 
4 #pragma once
5 
6 #include <string>
7 #include <cstdint>
8 
9 class CookieManager;
10 
17 class HttpHost {
18 public:
20  HttpHost(const std::string &hName = std::string(),
21  uint16_t sPort = 80,
22  const std::string &pHost = std::string(),
23  uint16_t pPort = 0,
24  CookieManager *cMgr = nullptr) :
25  hostname(hName), proxyHost(pHost),
26  port(sPort), proxyPort(pPort), cmgr(cMgr) {
27 #ifdef USE_GNUTLS
28  is_tls = (sPort == 443);
29 #endif
30  }
31  HttpHost(const char *hName, uint16_t sPort = 80) :
32  hostname(hName), port(sPort) {
33 #ifdef USE_GNUTLS
34  is_tls = (sPort == 443);
35 #endif
36  cmgr = nullptr;
37  }
38  std::string hostname;
39  std::string proxyHost;
40  uint16_t port;
41  uint16_t proxyPort;
42  CookieManager *cmgr;
43  uint16_t iptype = 0; // 4 for ipv4, 6 for ipv6, 0 for any.
44 #ifdef USE_GNUTLS
45  bool is_tls;
46 #endif
47 };
Definition: cookiemanager.h:14
The host name and port number of a HTTP host.
Definition: httphost.h:17
HttpHost(const std::string &hName=std::string(), uint16_t sPort=80, const std::string &pHost=std::string(), uint16_t pPort=0, CookieManager *cMgr=nullptr)
You create and own the cookie manager.
Definition: httphost.h:20