@@ -22,7 +22,7 @@ HTTPMessage::HTTPMessage() : ByteBuffer(4096) {
2222 this ->init ();
2323}
2424
25- HTTPMessage::HTTPMessage (string sData ) : ByteBuffer(sData .size()+1) {
25+ HTTPMessage::HTTPMessage (std:: string sData ) : ByteBuffer(sData .size()+1) {
2626 putBytes ((byte*)sData .c_str (), sData .size ()+1 );
2727 this ->init ();
2828}
@@ -44,7 +44,7 @@ void HTTPMessage::init() {
4444
4545 version = HTTP_VERSION; // By default, all create() will indicate the version is whatever HTTP_VERSION is
4646
47- headers = new map<string, string>();
47+ headers = new std:: map<std:: string, std:: string>();
4848}
4949
5050/* *
@@ -54,7 +54,7 @@ void HTTPMessage::init() {
5454 * @param str String to put into the byte buffer
5555 * @param crlf_end If true (default), end the line with a \r\n
5656 */
57- void HTTPMessage::putLine (string str, bool crlf_end) {
57+ void HTTPMessage::putLine (std:: string str, bool crlf_end) {
5858 // Terminate with crlf if flag set
5959 if (crlf_end)
6060 str += " \r\n " ;
@@ -69,9 +69,9 @@ void HTTPMessage::putLine(string str, bool crlf_end) {
6969 * 'Header: value'
7070 */
7171void HTTPMessage::putHeaders () {
72- map<string,string>::const_iterator it;
72+ std:: map<std:: string,std:: string>::const_iterator it;
7373 for (it = headers->begin (); it != headers->end (); it++) {
74- string final = it->first + " : " + it->second ;
74+ std:: string final = it->first + " : " + it->second ;
7575 putLine (final , true );
7676 }
7777
@@ -86,13 +86,13 @@ void HTTPMessage::putHeaders() {
8686 *
8787 * @return Contents of the line in a string (without CR or LF)
8888 */
89- string HTTPMessage::getLine () {
90- string ret = " " ;
89+ std:: string HTTPMessage::getLine () {
90+ std:: string ret = " " ;
9191 int startPos = getReadPos ();
9292 bool newLineReached = false ;
9393 char c = 0 ;
9494
95- // Append characters to the return string until we hit the end of the buffer, a CR (13) or LF (10)
95+ // Append characters to the return std:: string until we hit the end of the buffer, a CR (13) or LF (10)
9696 for (unsigned int i = startPos; i < size (); i++) {
9797 // If the next byte is a \r or \n, we've reached the end of the line and should break out of the loop
9898 c = peek ();
@@ -101,7 +101,7 @@ string HTTPMessage::getLine() {
101101 break ;
102102 }
103103
104- // Otherwise, append the next character to the string
104+ // Otherwise, append the next character to the std:: string
105105 ret += getChar ();
106106 }
107107
@@ -136,8 +136,8 @@ string HTTPMessage::getLine() {
136136 * @param delim The delimiter to stop at when retriving the element. By default, it's a space
137137 * @return Token found in the buffer. Empty if delimiter wasn't reached
138138 */
139- string HTTPMessage::getStrElement (char delim) {
140- string ret = " " ;
139+ std:: string HTTPMessage::getStrElement (char delim) {
140+ std:: string ret = " " ;
141141 int startPos = getReadPos ();
142142 unsigned int size = 0 ;
143143 int endPos = find (delim, startPos);
@@ -148,7 +148,7 @@ string HTTPMessage::getStrElement(char delim) {
148148 if ((endPos == -1 ) || (size <= 0 ))
149149 return " " ;
150150
151- // Grab the string from the byte buffer up to the delimiter
151+ // Grab the std:: string from the byte buffer up to the delimiter
152152 char *str = new char [size];
153153 getBytes ((byte*)str, size);
154154 str[size-1 ] = 0x00 ; // NULL termination
@@ -167,7 +167,7 @@ string HTTPMessage::getStrElement(char delim) {
167167 * Parse headers will move the read position past the blank line that signals the end of the headers
168168 */
169169void HTTPMessage::parseHeaders () {
170- string hline = " " , app = " " ;
170+ std:: string hline = " " , app = " " ;
171171
172172 // Get the first header
173173 hline = getLine ();
@@ -194,7 +194,7 @@ void HTTPMessage::parseHeaders() {
194194 */
195195bool HTTPMessage::parseBody () {
196196 // Content-Length should exist (size of the Body data) if there is body data
197- string hlenstr = " " ;
197+ std:: string hlenstr = " " ;
198198 unsigned int contentLen = 0 ;
199199 hlenstr = getHeaderValue (" Content-Length" );
200200
@@ -212,7 +212,7 @@ bool HTTPMessage::parseBody() {
212212 dataLen = bytesRemaining();
213213 */
214214 // If it exceeds, there's a potential security issue and we can't reliably parse
215- stringstream pes;
215+ std:: stringstream pes;
216216 pes << " Content-Length (" << hlenstr << " ) is greater than remaining bytes (" << bytesRemaining () << " )" ;
217217 parseErrorStr = pes.str ();
218218 return false ;
@@ -238,16 +238,16 @@ bool HTTPMessage::parseBody() {
238238
239239/* *
240240 * Add Header to the Map from string
241- * Takes a formatted header string "Header: value", parse it, and put it into the map as a key,value pair.
241+ * Takes a formatted header string "Header: value", parse it, and put it into the std:: map as a key,value pair.
242242 *
243243 * @param string containing formatted header: value
244244 */
245- void HTTPMessage::addHeader (string line) {
246- string key = " " , value = " " ;
245+ void HTTPMessage::addHeader (std:: string line) {
246+ std:: string key = " " , value = " " ;
247247 size_t kpos;
248248 int i = 0 ;
249249 kpos = line.find (' :' );
250- if (kpos == string::npos) {
250+ if (kpos == std:: string::npos) {
251251 printf (" Could not addHeader: %s\n " , line.c_str ());
252252 return ;
253253 }
@@ -265,26 +265,26 @@ void HTTPMessage::addHeader(string line) {
265265}
266266
267267/* *
268- * Add header key-value pair to the map
268+ * Add header key-value std:: pair to the map
269269 *
270270 * @param key String representation of the Header Key
271271 * @param value String representation of the Header value
272272 */
273- void HTTPMessage::addHeader (string key, string value) {
274- headers->insert (pair<string, string>(key, value));
273+ void HTTPMessage::addHeader (std:: string key, std:: string value) {
274+ headers->insert (std:: pair<std:: string, std:: string>(key, value));
275275}
276276
277277/* *
278- * Add header key-value pair to the map (Integer value)
278+ * Add header key-value std:: pair to the map (Integer value)
279279 * Integer value is converted to a string
280280 *
281281 * @param key String representation of the Header Key
282282 * @param value Integer representation of the Header value
283283 */
284- void HTTPMessage::addHeader (string key, int value) {
285- stringstream sz;
284+ void HTTPMessage::addHeader (std:: string key, int value) {
285+ std:: stringstream sz;
286286 sz << value;
287- headers->insert (pair<string, string>(key, sz.str ()));
287+ headers->insert (std:: pair<std:: string, std:: string>(key, sz.str ()));
288288}
289289
290290/* *
@@ -293,9 +293,9 @@ void HTTPMessage::addHeader(string key, int value) {
293293 *
294294 * @param key Key to identify the header
295295 */
296- string HTTPMessage::getHeaderValue (string key) {
296+ std:: string HTTPMessage::getHeaderValue (std:: string key) {
297297 // Lookup in map
298- map<string, string>::const_iterator it;
298+ std:: map<std:: string, std:: string>::const_iterator it;
299299 it = headers->find (key);
300300
301301 // Key wasn't found, return a blank value
@@ -312,10 +312,10 @@ string HTTPMessage::getHeaderValue(string key) {
312312 *
313313 * @ret Formatted string with header name and value
314314 */
315- string HTTPMessage::getHeaderStr (int index) {
315+ std:: string HTTPMessage::getHeaderStr (int index) {
316316 int i = 0 ;
317- string ret = " " ;
318- map<string,string>::const_iterator it;
317+ std:: string ret = " " ;
318+ std:: map<std:: string,std:: string>::const_iterator it;
319319 for (it = headers->begin (); it != headers->end (); it++) {
320320 if (i == index) {
321321 ret = it->first + " : " + it->second ;
0 commit comments