[or-cvs] Hack: Include date with successful directory GETs.

Nick Mathewson nickm at seul.org
Wed Aug 4 01:15:59 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv2640/src/or

Modified Files:
	directory.c 
Log Message:
Hack: Include date with successful directory GETs.

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- directory.c	22 Jul 2004 22:15:36 -0000	1.120
+++ directory.c	4 Aug 2004 01:15:57 -0000	1.121
@@ -498,6 +498,7 @@
   const char *cp;
   char *url;
   char tmp[8192];
+  char date[RFC1123_TIME_LEN+1];
 
   log_fn(LOG_DEBUG,"Received GET command.");
 
@@ -537,7 +538,9 @@
       return 0;
     }
 
-    snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nContent-Length: %d\r\nContent-Type: text/plain\r\n\r\n",
+    tor_format_rfc1123_time(date, time(NULL));
+    snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: text/plain\r\n\r\n",
+             date,
              (int)dlen);
     connection_write_to_buf(tmp, strlen(tmp), conn);
     connection_write_to_buf(cp, strlen(cp), conn);
@@ -560,7 +563,9 @@
     }
     switch(rend_cache_lookup_desc(url+strlen(rend_fetch_url), &descp, &desc_len)) {
       case 1: /* valid */
-        snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
+        tor_format_rfc1123_time(date, time(NULL));
+        snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
+                 date,
                  desc_len); /* can't include descp here, because it's got nuls */
         connection_write_to_buf(tmp, strlen(tmp), conn);
         connection_write_to_buf(descp, desc_len, conn);



More information about the tor-commits mailing list