summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-04-16 18:39:39 +0000
committerNick Mathewson <nickm@torproject.org>2007-04-16 18:39:39 +0000
commit6d32d9cb2d65c7851d87010e8971ddc271aa031b (patch)
tree524d29e6e65276e27368e40af851943b1b84755f /src/or/directory.c
parent2bb5e642899ce55a5846f1bdab58f97bef7523f6 (diff)
downloadtor-6d32d9cb2d65c7851d87010e8971ddc271aa031b.tar.gz
tor-6d32d9cb2d65c7851d87010e8971ddc271aa031b.zip
r12406@catbus: nickm | 2007-04-16 14:39:33 -0400
More proposal-104 stuff: add most of the code for authorities to accept and serve extra-info documents. The back-end to store the things is missing. svn:r9971
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 5188fa3ccc..e76108f9b2 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1683,31 +1683,34 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
return 0;
}
- if (!strcmpstart(url,"/tor/server/")) {
+ if (!strcmpstart(url,"/tor/server/") ||
+ !strcmpstart(url,"/tor/extra/")) {
size_t url_len = strlen(url);
int deflated = !strcmp(url+url_len-2, ".z");
int res;
const char *msg;
const char *request_type = NULL;
int cache_lifetime = 0;
+ int is_extra = !strcmpstart(url,"/tor/extra/");
if (deflated)
url[url_len-2] = '\0';
+ url += is_extra ? strlen("/tor/extra/") : strlen("/tor/server/");
conn->fingerprint_stack = smartlist_create();
res = dirserv_get_routerdesc_fingerprints(conn->fingerprint_stack, url,
&msg);
- if (!strcmpstart(url, "/tor/server/fp/")) {
+ if (!strcmpstart(url, "fp/")) {
request_type = deflated?"/tor/server/fp.z":"/tor/server/fp";
if (smartlist_len(conn->fingerprint_stack) == 1)
cache_lifetime = ROUTERDESC_CACHE_LIFETIME;
- } else if (!strcmpstart(url, "/tor/server/authority")) {
+ } else if (!strcmpstart(url, "authority")) {
request_type = deflated?"/tor/server/authority.z":
"/tor/server/authority";
cache_lifetime = ROUTERDESC_CACHE_LIFETIME;
- } else if (!strcmpstart(url, "/tor/server/all")) {
+ } else if (!strcmpstart(url, "all")) {
request_type = deflated?"/tor/server/all.z":"/tor/server/all";
cache_lifetime = FULL_DIR_CACHE_LIFETIME;
- } else if (!strcmpstart(url, "/tor/server/d/")) {
+ } else if (!strcmpstart(url, "d/")) {
request_type = deflated?"/tor/server/d.z":"/tor/server/d";
if (smartlist_len(conn->fingerprint_stack) == 1)
cache_lifetime = ROUTERDESC_BY_DIGEST_CACHE_LIFETIME;
@@ -1715,10 +1718,12 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
request_type = "/tor/server/?";
}
(void) request_type; /* usable for note_request. */
- if (!strcmpstart(url, "/tor/server/d/"))
- conn->dir_spool_src = DIR_SPOOL_SERVER_BY_DIGEST;
+ if (!strcmpstart(url, "d/"))
+ conn->dir_spool_src =
+ is_extra ? DIR_SPOOL_EXTRA_BY_DIGEST : DIR_SPOOL_SERVER_BY_DIGEST;
else
- conn->dir_spool_src = DIR_SPOOL_SERVER_BY_FP;
+ conn->dir_spool_src =
+ is_extra ? DIR_SPOOL_EXTRA_BY_FP : DIR_SPOOL_SERVER_BY_FP;
tor_free(url);
if (res < 0)
write_http_status_line(conn, 404, msg);