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

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

#1 change response, threading and proxy work-flow

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 ResetContent (void);
37
38public:
39 int GetStatusCode (void) const;
40
41 int SetResponse (const char * aHttpResponse,
42 const int aResponseLength);
43 std::string GetHeader (void) const;
44 const char * GetContentBody (void) const;
45 int GetContentLength (void) const;
46
47 CRXHttpResponse & operator = (const char * aHttpResponse);
48};
49
50#endif // #ifndef __CRXHTTPRESPONSE_H__
Note: See TracBrowser for help on using the repository browser.