mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Use tor_compress_supports_method() instead of constants.
See: https://bugs.torproject.org/21667
This commit is contained in:
parent
61b6de5906
commit
6305637197
@ -2336,14 +2336,14 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
|||||||
description2,
|
description2,
|
||||||
(compression>0 && guessed>0)?" Trying both.":"");
|
(compression>0 && guessed>0)?" Trying both.":"");
|
||||||
}
|
}
|
||||||
/* Try declared compression first if we can. */
|
/* Try declared compression first if we can.
|
||||||
if (compression == GZIP_METHOD || compression == ZLIB_METHOD)
|
* 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,
|
tor_uncompress(&new_body, &new_len, body, body_len, compression,
|
||||||
!allow_partial, LOG_PROTOCOL_WARN);
|
!allow_partial, LOG_PROTOCOL_WARN);
|
||||||
/* Okay, if that didn't work, and we think that it was compressed
|
/* Okay, if that didn't work, and we think that it was compressed
|
||||||
* differently, try that. */
|
* differently, try that. */
|
||||||
if (!new_body &&
|
if (!new_body && tor_compress_supports_method(guessed) &&
|
||||||
(guessed == GZIP_METHOD || guessed == ZLIB_METHOD) &&
|
|
||||||
compression != guessed)
|
compression != guessed)
|
||||||
tor_uncompress(&new_body, &new_len, body, body_len, guessed,
|
tor_uncompress(&new_body, &new_len, body, body_len, guessed,
|
||||||
!allow_partial, LOG_PROTOCOL_WARN);
|
!allow_partial, LOG_PROTOCOL_WARN);
|
||||||
|
Loading…
Reference in New Issue
Block a user