[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Decode Content-Encoding header correctly.
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv22582/src/or
Modified Files:
directory.c
Log Message:
Decode Content-Encoding header correctly.
Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- directory.c 29 Sep 2004 06:52:35 -0000 1.135
+++ directory.c 1 Oct 2004 04:45:14 -0000 1.136
@@ -229,10 +229,13 @@
switch(purpose) {
case DIR_PURPOSE_FETCH_DIR:
tor_assert(payload == NULL);
- if(use_newer)
+ if(use_newer) {
+ log_fn(LOG_DEBUG, "Asking for compressed directory from server running %s", router->platform);
connection_write_to_buf(fetchwholedir_z, strlen(fetchwholedir_z), conn);
- else
+ } else {
+ log_fn(LOG_DEBUG, "Asking for uncompressed directory from server running %s", router->platform);
connection_write_to_buf(fetchwholedir, strlen(fetchwholedir), conn);
+ }
break;
case DIR_PURPOSE_FETCH_RUNNING_LIST:
tor_assert(payload == NULL);
@@ -349,9 +352,9 @@
const char *enc = NULL;
SMARTLIST_FOREACH(parsed_headers, const char *, s,
if (!strcmpstart(s, "Content-Encoding: ")) {
- enc = s+16; break;
+ enc = s+18; break;
});
- if (!enc || strcmp(enc, "identity")) {
+ if (!enc || !strcmp(enc, "identity")) {
*compression = 0;
} else if (!strcmp(enc, "deflate") || !strcmp(enc, "x-deflate")) {
*compression = ZLIB_METHOD;