Skip to content

Commit d8e03c0

Browse files
committed
torcontrol: Improve comments
1 parent b6ee855 commit d8e03c0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/torcontrol.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ bool TorControlConnection::Command(const std::string &cmd, const ReplyHandlerCB&
250250

251251
/* Split reply line in the form 'AUTH METHODS=...' into a type
252252
* '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).
253255
*/
254256
static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s)
255257
{
@@ -265,6 +267,9 @@ static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s
265267
}
266268

267269
/** 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.
268273
*/
269274
static std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s)
270275
{
@@ -280,7 +285,7 @@ static std::map<std::string,std::string> ParseTorReplyMapping(const std::string
280285
return std::map<std::string,std::string>();
281286
++ptr; // skip '='
282287
if (ptr < s.size() && s[ptr] == '"') { // Quoted string
283-
++ptr; // skip '='
288+
++ptr; // skip opening '"'
284289
bool escape_next = false;
285290
while (ptr < s.size() && (!escape_next && s[ptr] != '"')) {
286291
escape_next = (s[ptr] == '\\');

0 commit comments

Comments
 (0)