3232// and to be compatible with other JSON-RPC implementations.
3333//
3434
35- string HTTPPost (const string& strMsg, const map<string,string>& mapRequestHeaders)
35+ std:: string HTTPPost (const std:: string& strMsg, const std:: map<std:: string,std:: string>& mapRequestHeaders)
3636{
37- ostringstream s;
37+ std:: ostringstream s;
3838 s << " POST / HTTP/1.1\r\n "
3939 << " User-Agent: gridcoin-json-rpc/" << FormatFullVersion () << " \r\n "
4040 << " Host: 127.0.0.1\r\n "
@@ -49,20 +49,20 @@ string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeader
4949 return s.str ();
5050}
5151
52- string rfc1123Time ()
52+ std:: string rfc1123Time ()
5353{
5454 char buffer[64 ];
5555 time_t now;
5656 time (&now);
5757 struct tm * now_gmt = gmtime (&now);
58- string locale (setlocale (LC_TIME, NULL ));
58+ std:: string locale (setlocale (LC_TIME, NULL ));
5959 setlocale (LC_TIME, " C" ); // we want POSIX (aka "C") weekday/month strings
6060 strftime (buffer, sizeof (buffer), " %a, %d %b %Y %H:%M:%S +0000" , now_gmt);
6161 setlocale (LC_TIME, locale.c_str ());
62- return string (buffer);
62+ return std:: string (buffer);
6363}
6464
65- string HTTPReply (int nStatus, const string& strMsg, bool keepalive)
65+ std:: string HTTPReply (int nStatus, const std:: string& strMsg, bool keepalive)
6666{
6767 if (nStatus == HTTP_UNAUTHORIZED)
6868 return strprintf (" HTTP/1.0 401 Authorization Required\r\n "
@@ -106,22 +106,22 @@ string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
106106 strMsg);
107107}
108108
109- int ReadHTTPHeaders (std::basic_istream<char >& stream, map<string, string>& mapHeadersRet)
109+ int ReadHTTPHeaders (std::basic_istream<char >& stream, std:: map<std:: string, std:: string>& mapHeadersRet)
110110{
111111 int nLen = 0 ;
112112 while (true )
113113 {
114- string str;
114+ std:: string str;
115115 std::getline (stream, str);
116116 if (str.empty () || str == " \r " )
117117 break ;
118- string::size_type nColon = str.find (" :" );
119- if (nColon != string::npos)
118+ std:: string::size_type nColon = str.find (" :" );
119+ if (nColon != std:: string::npos)
120120 {
121- string strHeader = str.substr (0 , nColon);
121+ std:: string strHeader = str.substr (0 , nColon);
122122 boost::trim (strHeader);
123123 boost::to_lower (strHeader);
124- string strValue = str.substr (nColon+1 );
124+ std:: string strValue = str.substr (nColon+1 );
125125 boost::trim (strValue);
126126 mapHeadersRet[strHeader] = strValue;
127127 if (strHeader == " content-length" )
@@ -132,13 +132,13 @@ int ReadHTTPHeaders(std::basic_istream<char>& stream, map<string, string>& mapHe
132132}
133133
134134bool ReadHTTPRequestLine (std::basic_istream<char >& stream, int &proto,
135- string& http_method, string& http_uri)
135+ std:: string& http_method, std:: string& http_uri)
136136{
137- string str;
138- getline (stream, str);
137+ std:: string str;
138+ std:: getline (stream, str);
139139
140140 // HTTP request line is space-delimited
141- vector<string> vWords;
141+ std:: vector<std:: string> vWords;
142142 boost::split (vWords, str, boost::is_any_of (" " ));
143143 if (vWords.size () < 2 )
144144 return false ;
@@ -154,7 +154,7 @@ bool ReadHTTPRequestLine(std::basic_istream<char>& stream, int &proto,
154154 return false ;
155155
156156 // parse proto, if present
157- string strProto = " " ;
157+ std:: string strProto;
158158 if (vWords.size () > 2 )
159159 strProto = vWords[2 ];
160160
@@ -168,9 +168,9 @@ bool ReadHTTPRequestLine(std::basic_istream<char>& stream, int &proto,
168168
169169int ReadHTTPStatus (std::basic_istream<char >& stream, int &proto)
170170{
171- string str;
172- getline (stream, str);
173- vector<string> vWords;
171+ std:: string str;
172+ std:: getline (stream, str);
173+ std:: vector<std:: string> vWords;
174174 boost::split (vWords, str, boost::is_any_of (" " ));
175175 if (vWords.size () < 2 )
176176 return HTTP_INTERNAL_SERVER_ERROR;
@@ -181,8 +181,8 @@ int ReadHTTPStatus(std::basic_istream<char>& stream, int &proto)
181181 return atoi (vWords[1 ].c_str ());
182182}
183183
184- int ReadHTTPMessage (std::basic_istream<char >& stream, map<string,
185- string>& mapHeadersRet, string& strMessageRet,
184+ int ReadHTTPMessage (std::basic_istream<char >& stream, std:: map<std:: string,
185+ std:: string>& mapHeadersRet, std:: string& strMessageRet,
186186 int nProto)
187187{
188188 mapHeadersRet.clear ();
@@ -196,12 +196,12 @@ int ReadHTTPMessage(std::basic_istream<char>& stream, map<string,
196196 // Read message
197197 if (nLen > 0 )
198198 {
199- vector<char > vch (nLen);
199+ std:: vector<char > vch (nLen);
200200 stream.read (&vch[0 ], nLen);
201- strMessageRet = string (vch.begin (), vch.end ());
201+ strMessageRet = std:: string (vch.begin (), vch.end ());
202202 }
203203
204- string sConHdr = mapHeadersRet[" connection" ];
204+ std:: string sConHdr = mapHeadersRet[" connection" ];
205205
206206 if ((sConHdr != " close" ) && (sConHdr != " keep-alive" ))
207207 {
@@ -224,7 +224,7 @@ int ReadHTTPMessage(std::basic_istream<char>& stream, map<string,
224224// http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx
225225//
226226
227- string JSONRPCRequest (const string& strMethod, const UniValue& params, const UniValue& id)
227+ std:: string JSONRPCRequest (const std:: string& strMethod, const UniValue& params, const UniValue& id)
228228{
229229 UniValue request (UniValue::VOBJ);
230230 request.push_back (Pair (" method" , strMethod));
@@ -245,13 +245,13 @@ UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const Un
245245 return reply;
246246}
247247
248- string JSONRPCReply (const UniValue& result, const UniValue& error, const UniValue& id)
248+ std:: string JSONRPCReply (const UniValue& result, const UniValue& error, const UniValue& id)
249249{
250250 UniValue reply = JSONRPCReplyObj (result, error, id);
251251 return reply.write () + " \n " ;
252252}
253253
254- UniValue JSONRPCError (int code, const string& message)
254+ UniValue JSONRPCError (int code, const std:: string& message)
255255{
256256 UniValue error (UniValue::VOBJ);
257257 error.pushKV (" code" , code);
0 commit comments