@@ -250,6 +250,8 @@ bool TorControlConnection::Command(const std::string &cmd, const ReplyHandlerCB&
250
250
251
251
/* Split reply line in the form 'AUTH METHODS=...' into a type
252
252
* 'AUTH' and arguments 'METHODS=...'.
253
+ * Grammar is implicitly defined in https://spec.torproject.org/control-spec by
254
+ * the server reply formats for PROTOCOLINFO (S3.21) and AUTHCHALLENGE (S3.24).
253
255
*/
254
256
static std::pair<std::string,std::string> SplitTorReplyLine (const std::string &s)
255
257
{
@@ -265,6 +267,9 @@ static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s
265
267
}
266
268
267
269
/* * Parse reply arguments in the form 'METHODS=COOKIE,SAFECOOKIE COOKIEFILE=".../control_auth_cookie"'.
270
+ * Grammar is implicitly defined in https://spec.torproject.org/control-spec by
271
+ * the server reply formats for PROTOCOLINFO (S3.21), AUTHCHALLENGE (S3.24),
272
+ * and ADD_ONION (S3.27). See also sections 2.1 and 2.3.
268
273
*/
269
274
static std::map<std::string,std::string> ParseTorReplyMapping (const std::string &s)
270
275
{
@@ -280,7 +285,7 @@ static std::map<std::string,std::string> ParseTorReplyMapping(const std::string
280
285
return std::map<std::string,std::string>();
281
286
++ptr; // skip '='
282
287
if (ptr < s.size () && s[ptr] == ' "' ) { // Quoted string
283
- ++ptr; // skip '= '
288
+ ++ptr; // skip opening '" '
284
289
bool escape_next = false ;
285
290
while (ptr < s.size () && (!escape_next && s[ptr] != ' "' )) {
286
291
escape_next = (s[ptr] == ' \\ ' );
0 commit comments