@@ -60,81 +60,81 @@ const static char* const requestMethodStr[NUM_METHODS] = {
6060
6161// HTTP Response Status codes
6262enum Status {
63- // 1xx Informational
64- CONTINUE = 100 ,
65-
66- // 2xx Success
67- OK = 200 ,
68-
69- // 3xx Redirection
70-
71- // 4xx Client Error
72- BAD_REQUEST = 400 ,
73- NOT_FOUND = 404 ,
74-
75- // 5xx Server Error
76- SERVER_ERROR = 500 ,
77- NOT_IMPLEMENTED = 501
63+ // 1xx Informational
64+ CONTINUE = 100 ,
65+
66+ // 2xx Success
67+ OK = 200 ,
68+
69+ // 3xx Redirection
70+
71+ // 4xx Client Error
72+ BAD_REQUEST = 400 ,
73+ NOT_FOUND = 404 ,
74+
75+ // 5xx Server Error
76+ SERVER_ERROR = 500 ,
77+ NOT_IMPLEMENTED = 501
7878};
7979
8080class HTTPMessage : public ByteBuffer {
8181private:
82- std::map<std::string, std::string> *headers;
82+ std::map<std::string, std::string> *headers;
8383
8484protected:
8585 std::string parseErrorStr;
86-
86+
8787 std::string version;
88-
88+
8989 // Message Body Data (Resource in the case of a response, extra parameters in the case of a request)
9090 byte* data;
9191 unsigned int dataLen;
9292
9393protected:
94- virtual void init ();
95-
94+ virtual void init ();
95+
9696public:
97- HTTPMessage ();
98- HTTPMessage (std::string sData );
99- HTTPMessage (byte *pData, unsigned int len);
100- virtual ~HTTPMessage ();
101-
97+ HTTPMessage ();
98+ HTTPMessage (std::string sData );
99+ HTTPMessage (byte *pData, unsigned int len);
100+ virtual ~HTTPMessage ();
101+
102102 virtual byte* create () = 0;
103103 virtual bool parse () = 0;
104-
105- // Create helpers
106- void putLine (std::string str = " " , bool crlf_end= true );
107- void putHeaders ();
108-
109- // Parse helpers
104+
105+ // Create helpers
106+ void putLine (std::string str = " " , bool crlf_end = true );
107+ void putHeaders ();
108+
109+ // Parse helpers
110110 std::string getLine ();
111- std::string getStrElement (char delim = 0x20 ); // 0x20 = "space"
112- void parseHeaders ();
113- bool parseBody ();
114-
115- // Header Map manipulation
111+ std::string getStrElement (char delim = 0x20 ); // 0x20 = "space"
112+ void parseHeaders ();
113+ bool parseBody ();
114+
115+ // Header Map manipulation
116116 void addHeader (std::string line);
117- void addHeader (std::string key, std::string value);
117+ void addHeader (std::string key, std::string value);
118118 void addHeader (std::string key, int value);
119- std::string getHeaderValue (std::string key);
119+ std::string getHeaderValue (std::string key);
120120 std::string getHeaderStr (int index);
121121 int getNumHeaders ();
122- void clearHeaders ();
123-
124- // Getters & Setters
122+ void clearHeaders ();
123+
124+ // Getters & Setters
125125
126126 std::string getParseError () {
127127 return parseErrorStr;
128128 }
129-
130- void setVersion (std::string v) {
131- version = v;
132- }
133-
134- std::string getVersion () {
135- return version;
136- }
137-
129+
130+ void setVersion (std::string v) {
131+ version = v;
132+ }
133+
134+ std::string getVersion () {
135+ return version;
136+ }
137+
138138 void setData (byte* d, unsigned int len) {
139139 data = d;
140140 dataLen = len;
0 commit comments