[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Add a /tor/dir-all-weaselhack directory resource so I do no...



Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv1490/src/or

Modified Files:
	directory.c 
Log Message:
Add a /tor/dir-all-weaselhack directory resource so I do not have to update my scripts

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.372
retrieving revision 1.373
diff -u -p -d -r1.372 -r1.373
--- directory.c	4 Jun 2006 22:42:12 -0000	1.372
+++ directory.c	15 Jun 2006 22:52:56 -0000	1.373
@@ -1646,6 +1646,33 @@ directory_handle_command_get(connection_
     return 0;
   }
 
+  if (!strcmp(url,"/tor/dir-all-weaselhack") && (conn->addr == 0x7f000001ul) &&
+      authdir_mode(get_options())) {
+    /* XXX until weasel rewrites his scripts  XXXX012 */
+    char *new_directory=NULL;
+
+    if (dirserv_dump_directory_to_string(&new_directory,
+                                         get_identity_key(), 1)) {
+      log_warn(LD_BUG, "Error creating full v1 directory.");
+      tor_free(new_directory);
+      write_http_status_line(conn, 503, "Directory unavailable");
+      return 0;
+    }
+
+    dlen = strlen(new_directory);
+
+    format_rfc1123_time(date, time(NULL));
+    tor_snprintf(tmp, sizeof(tmp),
+                 "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
+                 "Content-Type: text/plain\r\nContent-Encoding: identity\r\n\r\n",
+                 date,
+                 (int)dlen);
+    connection_write_to_buf(tmp, strlen(tmp), conn);
+    connection_write_to_buf(new_directory, dlen, conn);
+    tor_free(new_directory);
+  }
+
+
   /* we didn't recognize the url */
   write_http_status_line(conn, 404, "Not found");
   tor_free(url);