-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathHttpMessage.h
More file actions
88 lines (67 loc) · 2.49 KB
/
HttpMessage.h
File metadata and controls
88 lines (67 loc) · 2.49 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
/*
* Copyright (C) 2012 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 _HTTP_MESSAGE_H_
#define _HTTP_MESSAGE_H_
#define HTTP_VERSION "HTTP/1.1"
#include "HttpHeader.h"
#include "HttpUri.h"
/**
* @ingroup HttpParser
* @brief HTTP 메시지 클래스
*/
class CHttpMessage
{
public:
CHttpMessage();
~CHttpMessage();
int Parse( const char * pszText, int iTextLen );
int ParseHeader( const char * pszText, int iTextLen );
int ToString( char * pszText, int iTextSize );
void Clear();
bool AddHeader( const char * pszName, const char * pszValue );
bool AddHeader( const char * pszName, int iValue );
bool UpdateHeader( const char * pszName, const char * pszValue );
bool ReplaceHeader( const char * pszName, const char * pszValue );
CHttpHeader * GetHeader( const char * pszName );
bool SetRequest( const char * pszMethod, CHttpUri * pclsUri, const char * pszUserAgent = NULL );
bool IsRequest( );
/** HTTP 메소드 ( GET, POST ) */
std::string m_strHttpMethod;
/** HTTP request URI */
std::string m_strReqUri;
/** HTTP version ( HTTP/1.1 ) */
std::string m_strHttpVersion;
/** HTTP 응답 코드. HTTP 응답 메시지인 경우에만 0 보다 큰 값을 가지고 있다. */
int m_iStatusCode;
/** HTTP 응답 메시지 */
std::string m_strReasonPhrase;
/** HTTP Content-Type 헤더의 값 */
std::string m_strContentType;
/** HTTP Content-Length 헤더의 값 */
int m_iContentLength;
/** body 의 chunked 여부 */
bool m_bChunked;
/** HTTP 헤더 리스트 */
HTTP_HEADER_LIST m_clsHeaderList;
/** HTTP body */
std::string m_strBody;
private:
int ParseStatusLine( const char * pszText, int iTextLen );
int ParseRequestLine( const char * pszText, int iTextLen );
};
#endif