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