From 3e3480d70406d9deab79c478868ba5acb44255e7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 24 Jun 2011 16:43:08 -0400 Subject: Report reason for generating descriptor in an HTTP header Suggested by arma; based on 3327. --- src/or/directory.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/or/directory.c') 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); -- cgit v1.2.3-54-g00ecf