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

Function ReadHTTPHeaders

src/rpc/core/rpcprotocol.cpp:156–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156int ReadHTTPHeaders(basic_istream<char>& stream, map<string, string>& mapHeadersRet) {
157 int nLen = 0;
158 while (true) {
159 string str;
160 getline(stream, str);
161 if (str.empty() || str == "\r")
162 break;
163 string::size_type nColon = str.find(":");
164 if (nColon != string::npos) {
165 string strHeader = str.substr(0, nColon);
166 boost::trim(strHeader);
167 boost::to_lower(strHeader);
168 string strValue = str.substr(nColon + 1);
169 boost::trim(strValue);
170 mapHeadersRet[strHeader] = strValue;
171 if (strHeader == "content-length")
172 nLen = atoi(strValue.c_str());
173 }
174 }
175 return nLen;
176}
177
178int ReadHTTPMessage(basic_istream<char>& stream, map<string, string>& mapHeadersRet, string& strMessageRet,
179 int nProto) {

Callers 1

ReadHTTPMessageFunction · 0.85

Calls 4

trimFunction · 0.85
atoiFunction · 0.85
emptyMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected