-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCHttpHeaders.h
55 lines (44 loc) · 1.17 KB
/
CHttpHeaders.h
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
#pragma once
#include <atlstr.h>
#include <map>
#include <list>
#include <memory.h>
struct HttpHeader
{
CString strHeader;
CString strValue;
};
typedef std::list<HttpHeader*> HeaderList;
class CRefCountedHeaders
{
LONG m_lRef;
mutable HeaderList m_list;
public:
CRefCountedHeaders();
HeaderList& Headers() const;
void Addref();
void Release();
};
class CHttpHeaders
{
CRefCountedHeaders* m_Headers;
CString m_strVerb;
int m_iHeadersLength;
bool ExtractData(LPCTSTR pszText, int iMaxLen);
void OnLine(const CString& rstrLine);
static bool IsNewLine(LPTSTR psz, int iMaxLen);
public:
CHttpHeaders(void);
CHttpHeaders(const CHttpHeaders& headers);
~CHttpHeaders(void);
CHttpHeaders& operator = (const CHttpHeaders& headers);
static bool StartsAsHeader(LPCTSTR pszText, int iMaxLen);
HeaderList& GetHeaders();
bool GetHeader(LPCTSTR pszHeader, CString& rstrValue) const;
const CString& GetVerb() const;
bool Parse(LPCTSTR pszText, int iMaxLen);
int GetHeadersLength() const;
void GetHeadersFormated(CString& rstrHeadersOut);
bool IsResponse() const;
int GetStatusCode() const;
};