summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-06-24 16:43:08 -0400
committerNick Mathewson <nickm@torproject.org>2011-09-07 15:03:28 -0400
commit3e3480d70406d9deab79c478868ba5acb44255e7 (patch)
tree238b3378c9ac881372d2833ece1e61e49cc8853c /src/or/directory.c
parented463404e94d294ac474e6dd6921fdda54415daf (diff)
downloadtor-3e3480d70406d9deab79c478868ba5acb44255e7.tar.gz
tor-3e3480d70406d9deab79c478868ba5acb44255e7.zip
Report reason for generating descriptor in an HTTP header
Suggested by arma; based on 3327.
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 6055ae38dd..f56a63c08c 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1228,12 +1228,18 @@ directory_send_command(dir_connection_t *conn,
httpcommand = "GET";
tor_asprintf(&url, "/tor/micro/%s", resource);
break;
- case DIR_PURPOSE_UPLOAD_DIR:
+ case DIR_PURPOSE_UPLOAD_DIR: {
+ const char *why = router_get_descriptor_gen_reason();
tor_assert(!resource);
tor_assert(payload);
httpcommand = "POST";
url = tor_strdup("/tor/");
+ if (why) {
+ tor_asprintf(&header, "X-Desc-Gen-Reason: %s\r\n", why);
+ smartlist_add(headers, header);
+ }
break;
+ }
case DIR_PURPOSE_UPLOAD_VOTE:
tor_assert(!resource);
tor_assert(payload);