[or-cvs] special case so we don"t yell when an empty http body doesn...

Roger Dingledine arma at seul.org
Fri Jan 21 18:17:55 UTC 2005


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

Modified Files:
      Tag: tor-0_0_9-patches
	directory.c 
Log Message:
special case so we don't yell when an empty http body doesn't specify a
content-encoding


Index: directory.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.181.2.8
retrieving revision 1.181.2.9
diff -u -d -r1.181.2.8 -r1.181.2.9
--- directory.c	21 Jan 2005 02:06:27 -0000	1.181.2.8
+++ directory.c	21 Jan 2005 18:17:53 -0000	1.181.2.9
@@ -484,7 +484,7 @@
 
 /** Parse an HTTP response string <b>headers</b> of the form
  * "HTTP/1.\%d \%d\%s\r\n...".
- * If it's well-formed, assign *<b>code</b>, point  and return 0.
+ * If it's well-formed, assign *<b>code</b>, point and return 0.
  * If <b>date</b> is provided, set *date to the Date header in the
  * http headers, or 0 if no such header is found.
  * Otherwise, return -1.
@@ -518,7 +518,7 @@
       if (!strcmpstart(s, "Date: ")) {
         strlcpy(datestr, s+6, sizeof(datestr));
         /* This will do nothing on failure, so we don't need to check
-           the result.   We shouldn't warn, since there are many other valid
+           the result.  We shouldn't warn, since there are many other valid
            date formats besides the one we use. */
         parse_rfc1123_time(datestr, date);
         break;
@@ -554,6 +554,8 @@
 body_is_plausible(const char *body, size_t len, int purpose)
 {
   int i;
+  if (len == 0)
+    return 1; /* empty bodies don't need decompression */
   if (len < 32)
     return 0;
   if (purpose != DIR_PURPOSE_FETCH_RENDDESC) {



More information about the tor-commits mailing list