Last change
on this file since 46 was 46, checked in by cheese, 11 years ago |
#1 rename http message to http header and change way to process response content as binary
|
File size:
1.2 KB
|
Line | |
---|
1 | /**
|
---|
2 | * CRXHttpResponse.h
|
---|
3 | */
|
---|
4 | #ifndef __CRXHTTPRESPONSE_H__
|
---|
5 | #define __CRXHTTPRESPONSE_H__
|
---|
6 |
|
---|
7 | #include "CRXHttpHeader.h"
|
---|
8 |
|
---|
9 | #include <vector>
|
---|
10 |
|
---|
11 | #define ERROR_HTTP_RESPONSE -4000
|
---|
12 | #define ERROR_HTTP_RESPONSE_INVALID_LENGTH ERROR_HTTP_RESPONSE - 1
|
---|
13 | #define ERROR_HTTP_RESPONSE_INVALID_FORMAT ERROR_HTTP_RESPONSE - 2
|
---|
14 | #define ERROR_HTTP_RESPONSE_FAILED_TO_MEMORY_ALLOCATION ERROR_HTTP_RESPONSE - 3
|
---|
15 | #define ERROR_HTTP_RESPONSE_FAILED_TO_PARSE_CONTENT ERROR_HTTP_RESPONSE - 4
|
---|
16 |
|
---|
17 | class CRXHttpResponse : public CRXHttpHeader
|
---|
18 | {
|
---|
19 | private:
|
---|
20 | int mStatusCode;
|
---|
21 | std::string mStatusString;
|
---|
22 | bool mIsChunked; /* Transfer-Encoding */
|
---|
23 | unsigned int mContentLength;
|
---|
24 | std::vector <char> mContent;
|
---|
25 |
|
---|
26 | public:
|
---|
27 | CRXHttpResponse (void);
|
---|
28 | ~CRXHttpResponse (void);
|
---|
29 |
|
---|
30 | private:
|
---|
31 | void Parse (void);
|
---|
32 | void Reset (void);
|
---|
33 |
|
---|
34 | public:
|
---|
35 | int GetStatusCode (void) const;
|
---|
36 |
|
---|
37 | bool IsChunked (void) const;
|
---|
38 | void SetHeader (const char * aHeader);
|
---|
39 | std::string GetHeader (void) const;
|
---|
40 | int SetContent (const char * aContent,
|
---|
41 | const int aLength);
|
---|
42 | const char * GetContentBody (void) const;
|
---|
43 | int GetContentLength (void) const;
|
---|
44 | };
|
---|
45 |
|
---|
46 | #endif // #ifndef __CRXHTTPRESPONSE_H__
|
---|
Note:
See
TracBrowser
for help on using the repository browser.