source: cheroxy/trunk/include/CRXHttpResponse.h@ 26

Last change on this file since 26 was 26, checked in by cheese, 11 years ago

#1 add function to reset request and response

File size: 1.3 KB
Line 
1/**
2 * CRXHttpResponse.h
3 */
4#ifndef __CRXHTTPRESPONSE_H__
5#define __CRXHTTPRESPONSE_H__
6
7#include "CRXHttpMessage.h"
8
9#define ERROR_HTTP_RESPONSE -4000
10#define ERROR_HTTP_RESPONSE_INVALID_LENGTH ERROR_HTTP_RESPONSE - 1
11#define ERROR_HTTP_RESPONSE_INVALID_FORMAT ERROR_HTTP_RESPONSE - 2
12#define ERROR_HTTP_RESPONSE_FAILED_TO_MEMORY_ALLOCATION ERROR_HTTP_RESPONSE - 3
13#define ERROR_HTTP_RESPONSE_FAILED_TO_PARSE_CONTENT ERROR_HTTP_RESPONSE - 4
14
15class CRXHttpResponse : public CRXHttpMessage
16{
17private:
18 int mStatusCode;
19 std::string mStatusString;
20 bool mIsChunked; /* Transfer-Encoding */
21 int mContentLength;
22
23 struct __content_body__ {
24 char * mBody;
25 int mLength;
26 } mContent;
27
28public:
29 CRXHttpResponse (void);
30 ~CRXHttpResponse (void);
31
32private:
33 void Parse (void);
34 int ParseContent (const char * aContent,
35 const int aLength);
36 void Reset (void);
37 void ResetContent (void);
38
39public:
40 int GetStatusCode (void) const;
41
42 int SetResponse (const char * aHttpResponse,
43 const int aResponseLength);
44 std::string GetHeader (void) const;
45 const char * GetContentBody (void) const;
46 int GetContentLength (void) const;
47
48 CRXHttpResponse & operator = (const char * aHttpResponse);
49};
50
51#endif // #ifndef __CRXHTTPRESPONSE_H__
Note: See TracBrowser for help on using the repository browser.