[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11270: Fix a bug in last patch; add support for getting extrainfo d (in tor/trunk: . doc/spec src/or)
Author: nickm
Date: 2007-08-24 10:41:15 -0400 (Fri, 24 Aug 2007)
New Revision: 11270
Modified:
tor/trunk/
tor/trunk/doc/spec/control-spec.txt
tor/trunk/src/or/control.c
Log:
r14204@Kushana: nickm | 2007-08-24 10:24:36 -0400
Fix a bug in last patch; add support for getting extrainfo documents by the control port (since it is silly to tell tools to do it without actually giving them an interface).
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r14204] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/doc/spec/control-spec.txt
===================================================================
--- tor/trunk/doc/spec/control-spec.txt 2007-08-24 14:41:10 UTC (rev 11269)
+++ tor/trunk/doc/spec/control-spec.txt 2007-08-24 14:41:15 UTC (rev 11270)
@@ -367,6 +367,10 @@
"desc/id/<OR identity>" or "desc/name/<OR nickname>" -- the latest
server descriptor for a given OR, NUL-terminated.
+ "extra-info/digest/<digest>" -- the extrainfo document whose digest (in
+ hex) is <digest>. Only available if we're downloading extra-info
+ documents.
+
"ns/id/<OR identity>" or "ns/name/<OR nickname>" -- the latest network
status info for a given OR. Network status info is as given in
dir-spec.txt, and reflects the current beliefs of this Tor about the
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2007-08-24 14:41:10 UTC (rev 11269)
+++ tor/trunk/src/or/control.c 2007-08-24 14:41:15 UTC (rev 11270)
@@ -1316,7 +1316,7 @@
{
const char *body = signed_descriptor_get_body(&ri->cache_info);
signed_descriptor_t *ei = extrainfo_get_by_descriptor_digest(
- ri->cache_info.signed_descriptor_digest);
+ ri->cache_info.extra_info_digest);
if (ei && body) {
smartlist_add(sl, munge_extrainfo_into_routerinfo(body,
&ri->cache_info, ei));
@@ -1399,7 +1399,21 @@
list_server_status(routerlist->routers, answer, verbose ? 2 : 1) < 0) {
return -1;
}
+ } else if (!strcmpstart(question, "extra-info/digest/")) {
+ question += strlen("extra-info/digest/");
+ if (strlen(question) == HEX_DIGEST_LEN) {
+ char d[DIGEST_LEN];
+ signed_descriptor_t *sd;
+ base16_decode(d, sizeof(d), question, strlen(question));
+ sd = extrainfo_get_by_descriptor_digest(d);
+ if (sd) {
+ const char *body = signed_descriptor_get_body(sd);
+ if (body)
+ *answer = tor_strndup(body, sd->signed_descriptor_len);
+ }
+ }
}
+
return 0;
}
@@ -1649,6 +1663,7 @@
ITEM("desc/all-recent", dir,
"All non-expired, non-superseded router descriptors."),
ITEM("desc/all-recent-extrainfo-hack", dir, NULL), /* Hack. */
+ PREFIX("extrainfo/digest/", dir, "Extra-info documents by digest."),
ITEM("ns/all", networkstatus,
"Brief summary of router status (v2 directory format)"),
PREFIX("ns/id/", networkstatus,