From be364b603021705f47cb3e69e33ccbaa617c4b31 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 1 Aug 2021 10:25:29 +0530 Subject: [PATCH] cleanup adding of gzip to accept-encoding --- mechanize/_gzip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mechanize/_gzip.py b/mechanize/_gzip.py index e09c67b..7a7b347 100644 --- a/mechanize/_gzip.py +++ b/mechanize/_gzip.py @@ -185,10 +185,10 @@ def __copy__(self): def http_request(self, request): if self.request_gzip: existing = [ - x.strip() + x.strip().lower() for x in request.get_header('Accept-Encoding', '').split(',') ] - if sum('gzip' in x for x in existing) < 1: + if 'gzip' not in existing: existing.append('gzip') request.add_header("Accept-Encoding", ', '.join(filter(None, existing)))