aboutsummaryrefslogtreecommitdiff
path: root/src/torcontrol.cpp
diff options
context:
space:
mode:
authorJack Grigg <jack@z.cash>2017-03-25 20:13:18 +1300
committerJack Grigg <jack@z.cash>2017-05-16 18:21:54 +1200
commitd8e03c0340a65601a92ca3a69cfd3049cbaf49f1 (patch)
tree9afb18265a31fc264af0aef589fe4bc45f2a1441 /src/torcontrol.cpp
parentb6ee855b411ee9bc39f935d0da3298a773a2ed37 (diff)
downloadbitcoin-d8e03c0340a65601a92ca3a69cfd3049cbaf49f1.tar.xz
torcontrol: Improve comments
Diffstat (limited to 'src/torcontrol.cpp')
-rw-r--r--src/torcontrol.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp
index c1bd95b00f..2e15c9e732 100644
--- a/src/torcontrol.cpp
+++ b/src/torcontrol.cpp
@@ -250,6 +250,8 @@ bool TorControlConnection::Command(const std::string &cmd, const ReplyHandlerCB&
/* 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).
*/
static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s)
{
@@ -265,6 +267,9 @@ static std::pair<std::string,std::string> SplitTorReplyLine(const std::string &s
}
/** Parse reply arguments in the form 'METHODS=COOKIE,SAFECOOKIE COOKIEFILE=".../control_auth_cookie"'.
+ * Grammar is implicitly defined in https://spec.torproject.org/control-spec by
+ * the server reply formats for PROTOCOLINFO (S3.21), AUTHCHALLENGE (S3.24),
+ * and ADD_ONION (S3.27). See also sections 2.1 and 2.3.
*/
static std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s)
{
@@ -280,7 +285,7 @@ static std::map<std::string,std::string> ParseTorReplyMapping(const std::string
return std::map<std::string,std::string>();
++ptr; // skip '='
if (ptr < s.size() && s[ptr] == '"') { // Quoted string
- ++ptr; // skip '='
+ ++ptr; // skip opening '"'
bool escape_next = false;
while (ptr < s.size() && (!escape_next && s[ptr] != '"')) {
escape_next = (s[ptr] == '\\');