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

Function SplitTorReplyLine

src/torcontrol.cpp:253–264  ·  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

251 * the server reply formats for PROTOCOLINFO (S3.21) and AUTHCHALLENGE (S3.24).
252 */
253std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s)
254{
255 size_t ptr=0;
256 std::string type;
257 while (ptr < s.size() && s[ptr] != ' ') {
258 type.push_back(s[ptr]);
259 ++ptr;
260 }
261 if (ptr < s.size())
262 ++ptr; // skip ' '
263 return make_pair(type, s.substr(ptr));
264}
265
266/** Parse reply arguments in the form 'METHODS=COOKIE,SAFECOOKIE COOKIEFILE=".../control_auth_cookie"'.
267 * 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