aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2017-05-08 16:25:20 +0200
committerAlexander Færøy <ahf@torproject.org>2017-05-12 17:18:45 +0200
commit630563719728e039364b1e4cc2ada9017405a383 (patch)
tree6a5cb7dd8eff04dd905a821d5db86d826867a0fd /src/or/directory.c
parent61b6de5906b92fa1354efe60aa1506ab215d60b3 (diff)
downloadtor-630563719728e039364b1e4cc2ada9017405a383.tar.gz
tor-630563719728e039364b1e4cc2ada9017405a383.zip
Use tor_compress_supports_method() instead of constants.
See: https://bugs.torproject.org/21667
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 3df5be9d34..56d1cca333 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -2336,14 +2336,14 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
description2,
(compression>0 && guessed>0)?" Trying both.":"");
}
- /* Try declared compression first if we can. */
- if (compression == GZIP_METHOD || compression == ZLIB_METHOD)
+ /* Try declared compression first if we can.
+ * tor_compress_supports_method() also returns true for NO_METHOD. */
+ if (tor_compress_supports_method(compression))
tor_uncompress(&new_body, &new_len, body, body_len, compression,
!allow_partial, LOG_PROTOCOL_WARN);
/* Okay, if that didn't work, and we think that it was compressed
* differently, try that. */
- if (!new_body &&
- (guessed == GZIP_METHOD || guessed == ZLIB_METHOD) &&
+ if (!new_body && tor_compress_supports_method(guessed) &&
compression != guessed)
tor_uncompress(&new_body, &new_len, body, body_len, guessed,
!allow_partial, LOG_PROTOCOL_WARN);