MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / ReadHTTPMessage

Function ReadHTTPMessage

src/rpc/core/rpcprotocol.cpp:178–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178int ReadHTTPMessage(basic_istream<char>& stream, map<string, string>& mapHeadersRet, string& strMessageRet,
179 int nProto) {
180 mapHeadersRet.clear();
181 strMessageRet = "";
182
183 // Read header
184 int nLen = ReadHTTPHeaders(stream, mapHeadersRet);
185 if (nLen < 0 || nLen > (int)MAX_SIZE)
186 return HTTP_INTERNAL_SERVER_ERROR;
187
188 // Read message
189 if (nLen > 0) {
190 vector<char> vch(nLen);
191 stream.read(&vch[0], nLen);
192 strMessageRet = string(vch.begin(), vch.end());
193 }
194
195 string sConHdr = mapHeadersRet["connection"];
196
197 if ((sConHdr != "close") && (sConHdr != "keep-alive")) {
198 if (nProto >= 1)
199 mapHeadersRet["connection"] = "keep-alive";
200 else
201 mapHeadersRet["connection"] = "close";
202 }
203
204 return HTTP_OK;
205}
206
207//
208// JSON-RPC protocol. Coin speaks version 1.0 for maximum compatibility,

Callers 1

CallRPCFunction · 0.85

Calls 5

ReadHTTPHeadersFunction · 0.85
clearMethod · 0.45
readMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected