def is_encoding_acceptable(encoding_to_check): "Check if a content encoding is acceptable to the user agent." header = request.headers.get('Accept-Encoding', '') return 'gzip' in desired_matches(['gzip'], header)
def match_accept(self, mimetypes): """Return a list of specified mime-types that the browser's HTTP Accept header allows in the order provided.""" return desired_matches(mimetypes, self.environ.get('HTTP_ACCEPT', '*/*'))
def request_accepts_gzip(environ): accept_encoding = environ.get("HTTP_ACCEPT_ENCODING", "identity") return "gzip" in desired_matches(["gzip"], accept_encoding)