[or-cvs] clean up/bugfix deflate logic and log messages

Nick Mathewson nickm at seul.org
Tue Sep 21 18:09:41 UTC 2004


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

Modified Files:
	dirserv.c directory.c 
Log Message:
clean up/bugfix deflate logic and log messages

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- dirserv.c	8 Sep 2004 07:16:33 -0000	1.78
+++ dirserv.c	21 Sep 2004 18:09:38 -0000	1.79
@@ -678,8 +678,8 @@
   } else {
     log(LOG_INFO,"Directory still clean, reusing.");
   }
-  *directory = deflate ? the_directory : the_directory_z;
-  return deflate ? the_directory_len : the_directory_z_len;
+  *directory = deflate ? the_directory_z : the_directory;
+  return deflate ? the_directory_z_len : the_directory_len;
 }
 
 /**

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- directory.c	8 Sep 2004 06:52:33 -0000	1.126
+++ directory.c	21 Sep 2004 18:09:38 -0000	1.127
@@ -581,7 +581,8 @@
   }
 
   if(!strcmp(url,"/") || !strcmp(url,"/dir.z")) { /* directory fetch */
-    dlen = dirserv_get_directory(&cp, !strcmp(url,"/dir.z"));
+    int deflated = !strcmp(url,"/dir.z");
+    dlen = dirserv_get_directory(&cp, deflated);
 
     if(dlen == 0) {
       log_fn(LOG_WARN,"My directory is empty. Closing.");
@@ -589,12 +590,13 @@
       return 0;
     }
 
-    log_fn(LOG_DEBUG,"Dumping directory to client.");
+    log_fn(LOG_DEBUG,"Dumping %sdirectory to client.", 
+           deflated?"deflated ":"");
     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\nContent-Encoding: %s\r\n\r\n",
              date,
              (int)dlen,
-             strcmp(url,"/dir.z")?"identity":"deflate");
+             deflated?"deflate":"identity");
     connection_write_to_buf(tmp, strlen(tmp), conn);
     connection_write_to_buf(cp, strlen(cp), conn);
     return 0;



More information about the tor-commits mailing list