HttpClient.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. /*
  2. * Copyright: JessMA Open Source (ldcsaa@gmail.com)
  3. *
  4. * Author : Bruce Liang
  5. * Website : https://github.com/ldcsaa
  6. * Project : https://github.com/ldcsaa/HP-Socket
  7. * Blog : http://www.cnblogs.com/ldcsaa
  8. * Wiki : http://www.oschina.net/p/hp-socket
  9. * QQ Group : 44636872, 75375912
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. */
  23. #pragma once
  24. #include "TcpClient.h"
  25. #include "HttpHelper.h"
  26. #ifdef _HTTP_SUPPORT
  27. template<class R, class T, USHORT default_port> class CHttpClientT : public R, public T
  28. {
  29. using __super = T;
  30. public:
  31. using __super::Stop;
  32. using __super::Wait;
  33. using __super::GetState;
  34. using __super::SendPackets;
  35. using __super::HasStarted;
  36. using __super::GetRemoteHost;
  37. using __super::IsSecure;
  38. using __super::IsConnected;
  39. using __super::FireHandShake;
  40. #ifdef _SSL_SUPPORT
  41. using __super::IsSSLAutoHandShake;
  42. using __super::StartSSLHandShakeNoCheck;
  43. #endif
  44. protected:
  45. using __super::SetLastError;
  46. using THttpObj = THttpObjT<CHttpClientT, IHttpClient>;
  47. friend typename CHttpClientT::THttpObj;
  48. public:
  49. virtual BOOL SendRequest(LPCSTR lpszMethod, LPCSTR lpszPath, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0, const BYTE* pBody = nullptr, int iLength = 0);
  50. virtual BOOL SendLocalFile(LPCSTR lpszFileName, LPCSTR lpszMethod, LPCSTR lpszPath, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0);
  51. virtual BOOL SendChunkData(const BYTE* pData = nullptr, int iLength = 0, LPCSTR lpszExtensions = nullptr);
  52. virtual BOOL SendPost(LPCSTR lpszPath, const THeader lpHeaders[], int iHeaderCount, const BYTE* pBody, int iLength)
  53. {return SendRequest(HTTP_METHOD_POST, lpszPath, lpHeaders, iHeaderCount, pBody, iLength);}
  54. virtual BOOL SendPut(LPCSTR lpszPath, const THeader lpHeaders[], int iHeaderCount, const BYTE* pBody, int iLength)
  55. {return SendRequest(HTTP_METHOD_PUT, lpszPath, lpHeaders, iHeaderCount, pBody, iLength);}
  56. virtual BOOL SendPatch(LPCSTR lpszPath, const THeader lpHeaders[], int iHeaderCount, const BYTE* pBody, int iLength)
  57. {return SendRequest(HTTP_METHOD_PATCH, lpszPath, lpHeaders, iHeaderCount, pBody, iLength);}
  58. virtual BOOL SendGet(LPCSTR lpszPath, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0)
  59. {return SendRequest(HTTP_METHOD_GET, lpszPath, lpHeaders, iHeaderCount);}
  60. virtual BOOL SendDelete(LPCSTR lpszPath, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0)
  61. {return SendRequest(HTTP_METHOD_DELETE, lpszPath, lpHeaders, iHeaderCount);}
  62. virtual BOOL SendHead(LPCSTR lpszPath, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0)
  63. {return SendRequest(HTTP_METHOD_HEAD, lpszPath, lpHeaders, iHeaderCount);}
  64. virtual BOOL SendTrace(LPCSTR lpszPath, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0)
  65. {return SendRequest(HTTP_METHOD_TRACE, lpszPath, lpHeaders, iHeaderCount);}
  66. virtual BOOL SendOptions(LPCSTR lpszPath, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0)
  67. {return SendRequest(HTTP_METHOD_OPTIONS, lpszPath, lpHeaders, iHeaderCount);}
  68. virtual BOOL SendConnect(LPCSTR lpszHost, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0)
  69. {return SendRequest(HTTP_METHOD_CONNECT, lpszHost, lpHeaders, iHeaderCount);}
  70. virtual BOOL SendWSMessage(BOOL bFinal, BYTE iReserved, BYTE iOperationCode, const BYTE lpszMask[4], const BYTE* pData = nullptr, int iLength = 0, ULONGLONG ullBodyLen = 0);
  71. virtual BOOL StartHttp();
  72. public:
  73. virtual void SetUseCookie(BOOL bUseCookie) {ENSURE_HAS_STOPPED(); m_pCookieMgr = bUseCookie ? &g_CookieMgr : nullptr;}
  74. virtual void SetHttpAutoStart(BOOL bAutoStart) {ENSURE_HAS_STOPPED(); m_bHttpAutoStart = bAutoStart;}
  75. virtual void SetLocalVersion(EnHttpVersion enLocalVersion) {ENSURE_HAS_STOPPED(); m_enLocalVersion = enLocalVersion;}
  76. virtual BOOL IsUseCookie() {return m_pCookieMgr != nullptr;}
  77. virtual BOOL IsHttpAutoStart() {return m_bHttpAutoStart;}
  78. virtual EnHttpVersion GetLocalVersion() {return m_enLocalVersion;}
  79. virtual BOOL IsUpgrade()
  80. {return m_objHttp.IsUpgrade();}
  81. virtual BOOL IsKeepAlive()
  82. {return m_objHttp.IsKeepAlive();}
  83. virtual USHORT GetVersion()
  84. {return m_objHttp.GetVersion();}
  85. virtual ULONGLONG GetContentLength()
  86. {return m_objHttp.GetContentLength();}
  87. virtual LPCSTR GetContentType()
  88. {return m_objHttp.GetContentType();}
  89. virtual LPCSTR GetContentEncoding()
  90. {return m_objHttp.GetContentEncoding();}
  91. virtual LPCSTR GetTransferEncoding()
  92. {return m_objHttp.GetTransferEncoding();}
  93. virtual EnHttpUpgradeType GetUpgradeType()
  94. {return m_objHttp.GetUpgradeType();}
  95. virtual USHORT GetParseErrorCode(LPCSTR* lpszErrorDesc = nullptr)
  96. {return m_objHttp.GetParseErrorCode(lpszErrorDesc);}
  97. virtual BOOL GetHeader(LPCSTR lpszName, LPCSTR* lpszValue)
  98. {return m_objHttp.GetHeader(lpszName, lpszValue);}
  99. virtual BOOL GetHeaders(LPCSTR lpszName, LPCSTR lpszValue[], DWORD& dwCount)
  100. {return m_objHttp.GetHeaders(lpszName, lpszValue, dwCount);}
  101. virtual BOOL GetAllHeaders(THeader lpHeaders[], DWORD& dwCount)
  102. {return m_objHttp.GetAllHeaders(lpHeaders, dwCount);}
  103. virtual BOOL GetAllHeaderNames(LPCSTR lpszName[], DWORD& dwCount)
  104. {return m_objHttp.GetAllHeaderNames(lpszName, dwCount);}
  105. virtual BOOL GetCookie(LPCSTR lpszName, LPCSTR* lpszValue)
  106. {return m_objHttp.GetCookie(lpszName, lpszValue);}
  107. virtual BOOL GetAllCookies(TCookie lpCookies[], DWORD& dwCount)
  108. {return m_objHttp.GetAllCookies(lpCookies, dwCount);}
  109. virtual USHORT GetStatusCode()
  110. {return m_objHttp.GetStatusCode();}
  111. virtual BOOL GetWSMessageState(BOOL* lpbFinal, BYTE* lpiReserved, BYTE* lpiOperationCode, LPCBYTE* lpszMask, ULONGLONG* lpullBodyLen, ULONGLONG* lpullBodyRemain)
  112. {return m_objHttp.GetWSMessageState(lpbFinal, lpiReserved, lpiOperationCode, lpszMask, lpullBodyLen, lpullBodyRemain);}
  113. private:
  114. virtual BOOL CheckParams();
  115. void DoStartHttp()
  116. {m_objHttp.SetValid(TRUE);}
  117. virtual EnHandleResult FireConnect()
  118. {return m_bHttpAutoStart ? __super::FireConnect() : __super::DoFireConnect(this);}
  119. virtual EnHandleResult DoFireConnect(ITcpClient* pSender)
  120. {
  121. ASSERT(pSender == this);
  122. DoStartHttp();
  123. EnHandleResult result = __super::DoFireConnect(this);
  124. if(result == HR_ERROR)
  125. m_objHttp.SetValid(FALSE);
  126. return result;
  127. }
  128. virtual EnHandleResult DoFireReceive(ITcpClient* pSender, const BYTE* pData, int iLength)
  129. {ASSERT(pSender == this); return m_objHttp.IsValid() ? m_objHttp.Execute(pData, iLength) : __super::DoFireReceive(pSender, pData, iLength);}
  130. EnHandleResult DoFireSuperReceive(IHttpClient* pSender, const BYTE* pData, int iLength)
  131. {ASSERT(pSender == (IHttpClient*)this); return __super::DoFireReceive(pSender, pData, iLength);}
  132. virtual EnHandleResult DoFireClose(ITcpClient* pSender, EnSocketOperation enOperation, int iErrorCode)
  133. {
  134. ASSERT(pSender == (IHttpClient*)this);
  135. m_objHttp.CheckBodyIdentityEof();
  136. return __super::DoFireClose(pSender, enOperation, iErrorCode);
  137. }
  138. virtual void Reset()
  139. {
  140. m_objHttp.Reset();
  141. __super::Reset();
  142. }
  143. EnHttpParseResult FireMessageBegin(IHttpClient* pSender)
  144. {return m_pListener->OnMessageBegin(pSender, pSender->GetConnectionID());}
  145. EnHttpParseResult FireRequestLine(IHttpClient* pSender, LPCSTR lpszMethod, LPCSTR lpszUrl)
  146. {return m_pListener->OnRequestLine(pSender, pSender->GetConnectionID(), lpszMethod, lpszUrl);}
  147. EnHttpParseResult FireStatusLine(IHttpClient* pSender, USHORT usStatusCode, LPCSTR lpszDesc)
  148. {return m_pListener->OnStatusLine(pSender, pSender->GetConnectionID(), usStatusCode, lpszDesc);}
  149. EnHttpParseResult FireHeader(IHttpClient* pSender, LPCSTR lpszName, LPCSTR lpszValue)
  150. {return m_pListener->OnHeader(pSender, pSender->GetConnectionID(), lpszName, lpszValue);}
  151. EnHttpParseResult FireHeadersComplete(IHttpClient* pSender)
  152. {return m_pListener->OnHeadersComplete(pSender, pSender->GetConnectionID());}
  153. EnHttpParseResult FireBody(IHttpClient* pSender, const BYTE* pData, int iLength)
  154. {return m_pListener->OnBody(pSender, pSender->GetConnectionID(), pData, iLength);}
  155. EnHttpParseResult FireChunkHeader(IHttpClient* pSender, int iLength)
  156. {return m_pListener->OnChunkHeader(pSender, pSender->GetConnectionID(), iLength);}
  157. EnHttpParseResult FireChunkComplete(IHttpClient* pSender)
  158. {return m_pListener->OnChunkComplete(pSender, pSender->GetConnectionID());}
  159. EnHttpParseResult FireMessageComplete(IHttpClient* pSender)
  160. {return m_pListener->OnMessageComplete(pSender, pSender->GetConnectionID());}
  161. EnHttpParseResult FireUpgrade(IHttpClient* pSender, EnHttpUpgradeType enUpgradeType)
  162. {return m_pListener->OnUpgrade(pSender, pSender->GetConnectionID(), enUpgradeType);}
  163. EnHttpParseResult FireParseError(IHttpClient* pSender, int iErrorCode, LPCSTR lpszErrorDesc)
  164. {return m_pListener->OnParseError(pSender, pSender->GetConnectionID(), iErrorCode, lpszErrorDesc);}
  165. EnHandleResult FireWSMessageHeader(IHttpClient* pSender, BOOL bFinal, BYTE iReserved, BYTE iOperationCode, const BYTE lpszMask[4], ULONGLONG ullBodyLen)
  166. {return m_pListener->OnWSMessageHeader(pSender, pSender->GetConnectionID(), bFinal, iReserved, iOperationCode, lpszMask, ullBodyLen);}
  167. EnHandleResult FireWSMessageBody(IHttpClient* pSender, const BYTE* pData, int iLength)
  168. {return m_pListener->OnWSMessageBody(pSender, pSender->GetConnectionID(), pData, iLength);}
  169. EnHandleResult FireWSMessageComplete(IHttpClient* pSender)
  170. {return m_pListener->OnWSMessageComplete(pSender, pSender->GetConnectionID());}
  171. CCookieMgr* GetCookieMgr() {return m_pCookieMgr;}
  172. LPCSTR GetRemoteDomain(IHttpClient* pSender) {LPCSTR lpszDomain; GetRemoteHost(&lpszDomain); return lpszDomain;}
  173. public:
  174. CHttpClientT(IHttpClientListener* pListener)
  175. : T (pListener)
  176. , m_pListener (pListener)
  177. , m_pCookieMgr (&g_CookieMgr)
  178. , m_bHttpAutoStart (TRUE)
  179. , m_enLocalVersion (DEFAULT_HTTP_VERSION)
  180. , m_objHttp (FALSE, this, (IHttpClient*)this)
  181. {
  182. }
  183. virtual ~CHttpClientT()
  184. {
  185. ENSURE_STOP();
  186. }
  187. private:
  188. BOOL m_bHttpAutoStart;
  189. IHttpClientListener* m_pListener;
  190. CCookieMgr* m_pCookieMgr;
  191. EnHttpVersion m_enLocalVersion;
  192. CReentrantCriSec m_csHttp;
  193. protected:
  194. THttpObj m_objHttp;
  195. };
  196. // ------------------------------------------------------------------------------------------------------------- //
  197. template<class T, USHORT default_port> class CHttpSyncClientT : public CHttpClientT<IHttpSyncRequester, T, default_port>, private CHttpClientListener
  198. {
  199. using __super = CHttpClientT<IHttpSyncRequester, T, default_port>;
  200. using __super::m_objHttp;
  201. using __super::SetLastError;
  202. using typename __super::THttpObj;
  203. public:
  204. using __super::Stop;
  205. using __super::Wait;
  206. using __super::GetState;
  207. using __super::HasStarted;
  208. using __super::GetRemoteHost;
  209. using __super::SendLocalFile;
  210. using __super::IsHttpAutoStart;
  211. public:
  212. virtual BOOL Start(LPCTSTR lpszRemoteAddress, USHORT usPort, BOOL bAsyncConnect = TRUE, LPCTSTR lpszBindAddress = nullptr, USHORT usLocalPort = 0);
  213. public:
  214. virtual BOOL SendRequest(LPCSTR lpszMethod, LPCSTR lpszPath, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0, const BYTE* pBody = nullptr, int iLength = 0);
  215. virtual BOOL SendWSMessage(BOOL bFinal, BYTE iReserved, BYTE iOperationCode, const BYTE lpszMask[4] = nullptr, const BYTE* pData = nullptr, int iLength = 0, ULONGLONG ullBodyLen = 0);
  216. public:
  217. virtual BOOL IsUpgrade()
  218. {return m_pHttpObj->IsUpgrade();}
  219. virtual BOOL IsKeepAlive()
  220. {return m_pHttpObj->IsKeepAlive();}
  221. virtual USHORT GetVersion()
  222. {return m_pHttpObj->GetVersion();}
  223. virtual ULONGLONG GetContentLength()
  224. {return m_pHttpObj->GetContentLength();}
  225. virtual LPCSTR GetContentType()
  226. {return m_pHttpObj->GetContentType();}
  227. virtual LPCSTR GetContentEncoding()
  228. {return m_pHttpObj->GetContentEncoding();}
  229. virtual LPCSTR GetTransferEncoding()
  230. {return m_pHttpObj->GetTransferEncoding();}
  231. virtual EnHttpUpgradeType GetUpgradeType()
  232. {return m_pHttpObj->GetUpgradeType();}
  233. virtual USHORT GetParseErrorCode(LPCSTR* lpszErrorDesc = nullptr)
  234. {return m_pHttpObj->GetParseErrorCode(lpszErrorDesc);}
  235. virtual BOOL GetHeader(LPCSTR lpszName, LPCSTR* lpszValue)
  236. {return m_pHttpObj->GetHeader(lpszName, lpszValue);}
  237. virtual BOOL GetHeaders(LPCSTR lpszName, LPCSTR lpszValue[], DWORD& dwCount)
  238. {return m_pHttpObj->GetHeaders(lpszName, lpszValue, dwCount);}
  239. virtual BOOL GetAllHeaders(THeader lpHeaders[], DWORD& dwCount)
  240. {return m_pHttpObj->GetAllHeaders(lpHeaders, dwCount);}
  241. virtual BOOL GetAllHeaderNames(LPCSTR lpszName[], DWORD& dwCount)
  242. {return m_pHttpObj->GetAllHeaderNames(lpszName, dwCount);}
  243. virtual BOOL GetCookie(LPCSTR lpszName, LPCSTR* lpszValue)
  244. {return m_pHttpObj->GetCookie(lpszName, lpszValue);}
  245. virtual BOOL GetAllCookies(TCookie lpCookies[], DWORD& dwCount)
  246. {return m_pHttpObj->GetAllCookies(lpCookies, dwCount);}
  247. virtual USHORT GetStatusCode()
  248. {return m_pHttpObj->GetStatusCode();}
  249. virtual BOOL GetWSMessageState(BOOL* lpbFinal, BYTE* lpiReserved, BYTE* lpiOperationCode, LPCBYTE* lpszMask, ULONGLONG* lpullBodyLen, ULONGLONG* lpullBodyRemain)
  250. {return m_pHttpObj->GetWSMessageState(lpbFinal, lpiReserved, lpiOperationCode, lpszMask, lpullBodyLen, lpullBodyRemain);}
  251. public:
  252. virtual BOOL OpenUrl(LPCSTR lpszMethod, LPCSTR lpszUrl, const THeader lpHeaders[] = nullptr, int iHeaderCount = 0, const BYTE* pBody = nullptr, int iLength = 0, BOOL bForceReconnect = FALSE);
  253. virtual BOOL CleanupRequestResult();
  254. public:
  255. virtual BOOL GetResponseBody (LPCBYTE* lpszBody, int* iLength);
  256. virtual void SetConnectTimeout (DWORD dwConnectTimeout) {ENSURE_HAS_STOPPED(); m_dwConnectTimeout = dwConnectTimeout;}
  257. virtual void SetRequestTimeout (DWORD dwRequestTimeout) {ENSURE_HAS_STOPPED(); m_dwRequestTimeout = dwRequestTimeout;}
  258. virtual DWORD GetConnectTimeout () {return m_dwConnectTimeout;}
  259. virtual DWORD GetRequestTimeout () {return m_dwRequestTimeout;}
  260. private:
  261. virtual EnHandleResult OnHandShake(ITcpClient* pSender, CONNID dwConnID);
  262. virtual EnHandleResult OnClose(ITcpClient* pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode);
  263. virtual EnHttpParseResult OnBody(IHttpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
  264. virtual EnHttpParseResult OnMessageComplete(IHttpClient* pSender, CONNID dwConnID);
  265. virtual EnHttpParseResult OnUpgrade(IHttpClient* pSender, CONNID dwConnID, EnHttpUpgradeType enUpgradeType);
  266. virtual EnHttpParseResult OnParseError(IHttpClient* pSender, CONNID dwConnID, int iErrorCode, LPCSTR lpszErrorDesc);
  267. virtual EnHandleResult OnWSMessageBody(IHttpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
  268. virtual EnHandleResult OnWSMessageComplete(IHttpClient* pSender, CONNID dwConnID);
  269. virtual EnHandleResult OnPrepareConnect(ITcpClient* pSender, CONNID dwConnID, SOCKET socket);
  270. virtual EnHandleResult OnConnect(ITcpClient* pSender, CONNID dwConnID);
  271. virtual EnHandleResult OnSend(ITcpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
  272. virtual EnHandleResult OnReceive(ITcpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength);
  273. virtual EnHttpParseResult OnMessageBegin(IHttpClient* pSender, CONNID dwConnID);
  274. virtual EnHttpParseResult OnStatusLine(IHttpClient* pSender, CONNID dwConnID, USHORT usStatusCode, LPCSTR lpszDesc);
  275. virtual EnHttpParseResult OnHeader(IHttpClient* pSender, CONNID dwConnID, LPCSTR lpszName, LPCSTR lpszValue);
  276. virtual EnHttpParseResult OnHeadersComplete(IHttpClient* pSender, CONNID dwConnID);
  277. virtual EnHttpParseResult OnChunkHeader(IHttpClient* pSender, CONNID dwConnID, int iLength);
  278. virtual EnHttpParseResult OnChunkComplete(IHttpClient* pSender, CONNID dwConnID);
  279. virtual EnHandleResult OnWSMessageHeader(IHttpClient* pSender, CONNID dwConnID, BOOL bFinal, BYTE iReserved, BYTE iOperationCode, const BYTE lpszMask[4], ULONGLONG ullBodyLen);
  280. private:
  281. void SetRequestEvent(EnHttpSyncRequestProgress enProgress, BOOL bCopyHttpObj = TRUE);
  282. BOOL WaitForEvent(DWORD dwWait);
  283. public:
  284. CHttpSyncClientT(IHttpClientListener* pListener = nullptr)
  285. : __super (this)
  286. , m_enProgress (HSRP_DONE)
  287. , m_objHttp2 (FALSE, this, (IHttpClient*)this)
  288. , m_pHttpObj (nullptr)
  289. , m_pListener2 (pListener)
  290. , m_dwConnectTimeout (DEFAULT_HTTP_SYNC_CONNECT_TIMEOUT)
  291. , m_dwRequestTimeout (DEFAULT_HTTP_SYNC_REQUEST_TIMEOUT)
  292. {
  293. }
  294. virtual ~CHttpSyncClientT()
  295. {
  296. ENSURE_STOP();
  297. }
  298. private:
  299. DWORD m_dwConnectTimeout;
  300. DWORD m_dwRequestTimeout;
  301. CEvt m_evWait;
  302. THttpObj m_objHttp2;
  303. THttpObj* m_pHttpObj;
  304. IHttpClientListener* m_pListener2;
  305. EnHttpSyncRequestProgress m_enProgress;
  306. CBufferPtrT<BYTE, 16 * 1024> m_szBuffer;
  307. };
  308. // ------------------------------------------------------------------------------------------------------------- //
  309. typedef CHttpClientT<IHttpRequester, CTcpClient, HTTP_DEFAULT_PORT> CHttpClient;
  310. typedef CHttpSyncClientT<CTcpClient, HTTP_DEFAULT_PORT> CHttpSyncClient;
  311. #ifdef _SSL_SUPPORT
  312. #include "SSLClient.h"
  313. typedef CHttpClientT<IHttpRequester, CSSLClient, HTTPS_DEFAULT_PORT> CHttpsClient;
  314. typedef CHttpSyncClientT<CSSLClient, HTTPS_DEFAULT_PORT> CHttpsSyncClient;
  315. #endif
  316. #endif