MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SplitTorReplyLine

Function SplitTorReplyLine

src/torcontrol.cpp:240–251  ·  view source on GitHub ↗

Split reply line in the form 'AUTH METHODS=...' into a type * 'AUTH' and arguments 'METHODS=...'. * Grammar is implicitly defined in https://spec.torproject.org/control-spec by * the server reply formats for PROTOCOLINFO (S3.21) and AUTHCHALLENGE (S3.24). */

Source from the content-addressed store, hash-verified

238 * the server reply formats for PROTOCOLINFO (S3.21) and AUTHCHALLENGE (S3.24).
239 */
240std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s)
241{
242 size_t ptr=0;
243 std::string type;
244 while (ptr < s.size() && s[ptr] != ' ') {
245 type.push_back(s[ptr]);
246 ++ptr;
247 }
248 if (ptr < s.size())
249 ++ptr; // skip ' '
250 return make_pair(type, s.substr(ptr));
251}
252
253/** Parse reply arguments in the form 'METHODS=COOKIE,SAFECOOKIE COOKIEFILE=".../control_auth_cookie"'.
254 * Returns a map of keys to values, or an empty map if there was an error.

Callers 3

authchallenge_cbMethod · 0.85
protocolinfo_cbMethod · 0.85
CheckSplitTorReplyLineFunction · 0.85

Calls 2

sizeMethod · 0.45
push_backMethod · 0.45

Tested by 1

CheckSplitTorReplyLineFunction · 0.68