-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathHttp2Client.h
More file actions
93 lines (76 loc) · 2.6 KB
/
Copy pathHttp2Client.h
File metadata and controls
93 lines (76 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright (C) 2021 Yee Young Han <websearch@naver.com> (http://blog.naver.com/websearch)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _HTTP2_CLIENT_H_
#define _HTTP2_CLIENT_H_
#include "HttpMessage.h"
#include "SipTcp.h"
#include "TlsFunction.h"
#include "Http2Conversion.h"
#include "Http2FrameList.h"
#include "Http2Packet.h"
#ifdef WIN32
#if _MSC_VER == VC2008_VERSION
#include "PcapSave.h"
#endif
#endif
/**
* @ingroup HttpStack
* @brief HTTP/2 Ŭ¶óÀ̾ðÆ®
*/
class CHttp2Client
{
public:
CHttp2Client();
~CHttp2Client();
bool Connect( const char * pszIp, int iPort, const char * pszClientPemFileName = NULL, const char * pszPcapFileName = NULL );
bool Close();
bool DoGet( const char * pszPath, std::string & strOutputContentType, std::string & strOutputBody );
bool DoPost( const char * pszPath, HTTP_HEADER_LIST * pclsHeaderList, const char * pszInputContentType, const char * pszInputBody, int iInputBodyLen, std::string & strOutputContentType, std::string & strOutputBody );
int GetStatusCode();
private:
bool Execute( CHttpMessage * pclsRequest, CHttpMessage * pclsResponse );
int Send( char * pszPacket, int iPacketLen );
int Recv( char * pszPacket, int iPacketSize );
bool RecvNonBlocking();
bool SendSettingsAck();
bool SendPingAck();
Socket m_hSocket;
SSL * m_psttSsl;
SSL_CTX * m_psttCtx;
uint32_t m_iStreamIdentifier;
CHttp2Conversion m_clsSendConversion;
CHttp2Conversion m_clsRecvConversion;
CHttp2FrameList m_clsFrameList;
CHttp2Frame m_clsFrame;
CHttp2Packet m_clsPacket;
std::string m_strHost;
pollfd m_sttPoll[1];
uint8_t m_szPacket[TCP_INIT_BUF_SIZE];
std::string m_strServerIp;
int m_iServerPort;
std::string m_strClientIp;
int m_iClientPort;
int m_iStatusCode;
bool m_bHttpHeaderLog;
#ifdef WIN32
#if _MSC_VER == VC2008_VERSION
CPcapSave m_clsPcap;
#endif
#endif
};
#endif