[or-cvs] start to fix http status stuff, more work needed

Roger Dingledine arma at seul.org
Thu Jan 20 20:07:39 UTC 2005


Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or

Modified Files:
	directory.c 
Log Message:
start to fix http status stuff, more work needed


Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- directory.c	20 Jan 2005 19:46:02 -0000	1.197
+++ directory.c	20 Jan 2005 20:07:36 -0000	1.198
@@ -820,13 +820,19 @@
   return 0;
 }
 
+/** Create an http response for the client <b>conn</b> out of
+ * <b>status</b> and <b>reason_phrase</b>. Write it to <b>conn</b>.
+ */
 static void
 write_http_status_line(connection_t *conn, int status,
                        const char *reason_phrase)
 {
-  char buf[128];
-  if (tor_snprintf(buf, sizeof(buf), "HTTP/1.0 %d %s\r\n\r\n")<0)
+  char buf[256];
+  if (tor_snprintf(buf, sizeof(buf), "HTTP/1.0 %d %s\r\n\r\n",
+      status, reason_phrase) < 0) {
+    log_fn(LOG_WARN,"Bug: status line too long.");
     return;
+  }
   connection_write_to_buf(buf, strlen(buf), conn);
 }
 
@@ -910,7 +916,7 @@
        * if we're gone to the site recently, and 404 if we haven't.
        *
        * Reject. */
-      write_http_status_line(conn, 400, "Nonauthorative directory does not not store rendezvous descriptors.");
+      write_http_status_line(conn, 400, "Nonauthoritative directory does not not store rendezvous descriptors.");
       tor_free(url);
       return 0;
     }
@@ -959,7 +965,7 @@
   if (!authdir_mode(get_options())) {
     /* we just provide cached directories; we don't want to
      * receive anything. */
-    write_http_status_line(conn, 400, "Not authoritative server");
+    write_http_status_line(conn, 400, "Nonauthoritative directory does not not store server descriptors");
     return 0;
   }
 
@@ -978,7 +984,7 @@
         break;
       case 0:
         /* descriptor was well-formed but server has not been approved */
-        write_http_status_line(conn, 200, "Unverified server descriptor accepted");
+        write_http_status_line(conn, 200, "Unverified server descriptor accepted. Have you mailed us your key fingerprint? Are you using the right key?");
         break;
       case 1:
         dirserv_get_directory(&cp, 0); /* rebuild and write to disk */



More information about the tor-commits mailing list