Enable support for gzipped responses with this request.
344914
public function enableGzip()
  {
    $this->setRequestHeaders(array("Accept-Encoding" => "gzip"));
    $this->canGzip = true;
    $this->setUserAgent($this->userAgent);
  }
1189808
def _respond(self, resp):
        """"""
        response_queue = self._response_queues.get(timeout=0.1)
        response_queue.put(resp)
        self._completed_response_lines = []
        self._is_multiline = None
1055773
def _map_response(response, decode=False):
    """"""
    # This causes weird deepcopy errors, so it's commented out for now.
    # item._urllib3_response = response
    item = httplib2.Response(response.getheaders())
    item.status = response.status
    item['status'] = str(item.status)
    item.reason = response.reason
    item.version = response.version

    # httplib2 expects the content-encoding header to be stripped and the
    # content length to be the length of the uncompressed content.
    # This does not occur for 'HEAD' requests.
    if decode and item.get('content-encoding') in ['gzip', 'deflate']:
        item['content-length'] = str(len(response.data))
        item['-content-encoding'] = item.pop('content-encoding')

    return item
699057
def make_response(self, status, content_type, response):
        """"""
        headers = [('Access-Control-Allow-Origin', '*'),
                   ('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'),
                   ('Access-Control-Allow-Headers', 'Content-Type'),
                   ('Access-Control-Max-Age', '86400'),
                   ('Content-type', content_type)
                  ]
        self.start_response(status, headers)
        return [response.encode()]
1109552
@Nonnull
  public static EChange setResponseCompressionEnabled (final boolean bResponseCompressionEnabled)
  {
    return s_aRWLock.writeLocked ( () -> {
      if (s_bResponseCompressionEnabled == bResponseCompressionEnabled)
        return EChange.UNCHANGED;
      s_bResponseCompressionEnabled = bResponseCompressionEnabled;
      LOGGER.info ("CompressFilter responseCompressionEnabled=" + bResponseCompressionEnabled);
      return EChange.CHANGED;
    });
  }
247020
function init(options, requestBody, type) {
    /**
     * If the user asked for a file, simply return the string.
     */
    if (type && type === "file") {
        return processItems(requestBody);
    }

    /**
     * Otherwise return a function to be used a middleware
     */
    return function(req, res) {
        /**
         * default to using the uncompressed string
         * @type {String}
         */
        var output = processItems(requestBody);

        /**
         * Set the appropriate headers for caching
         */
        setHeaders(res, output);
        if (isConditionalGet(req) && fresh(req.headers, res._headers)) {
            return notModified(res);
        }

        /**
         * If gzip is supported, compress the string once
         * and save for future requests
         */
        if (supportsGzip(req)) {
            res.setHeader("Content-Encoding", "gzip");
            var buf = new Buffer(output, "utf-8");
            zlib.gzip(buf, function(_, result) {
                res.end(result);
            });
        } else {
            res.end(output);
        }
    };
}
400675
function decompressResponse (res) {
  var encoding = lowercase(res.headers['content-encoding']);
  var isCompressed = ['gzip', 'compress', 'deflate'].indexOf(encoding) >= 0;

  if (isCompressed) {
    // The response is compressed, so add decompression middleware to the stream
    res.pipe(zlib.createUnzip());

    // Remove the content-encoding header, to prevent double-decoding
    delete res.headers['content-encoding'];
  }
}
318839
def process_response(self, request, response):
        """"""

        # For debug only.
        if not settings.DEBUG:
            return response

        # Check for responses where the data can't be inserted.
        content_encoding = response.get('Content-Encoding', '')
        content_type = response.get('Content-Type', '').split(';')[0]
        if any((getattr(response, 'streaming', False),
                'gzip' in content_encoding,
                content_type not in _HTML_TYPES)):
            return response

        content = force_text(response.content, encoding=settings.DEFAULT_CHARSET)

        pattern = re.escape('</body>')
        bits = re.split(pattern, content, flags=re.IGNORECASE)

        if len(bits) > 1:
            bits[-2] += debug_payload(request, response, self.view_data)
            response.content = "</body>".join(bits)
            if response.get('Content-Length', None):
                response['Content-Length'] = len(response.content)

        return response
60198
public FoxHttpClientBuilder activteGZipResponseInterceptor(int weight) throws FoxHttpException {
        foxHttpClient.register(FoxHttpInterceptorType.RESPONSE, new GZipResponseInterceptor(weight));
        return this;
    }
439842
public function RequestHandle()
    {
        if (\Zippy\WebApplication::$app->getRequest()->isBinaryRequest()) {
            $this->binaryOutput();
        }
        if (\Zippy\WebApplication::$app->getRequest()->isAjaxRequest()) {
            $this->Refresh();
            \Zippy\WebApplication::$app->getResponse()->addAjaxResponse($this->AjaxAnswer());
        }
    }
836739
public function disableGzip()
  {
    if (
        isset($this->requestHeaders['accept-encoding']) &&
        $this->requestHeaders['accept-encoding'] == "gzip"
    ) {
      unset($this->requestHeaders['accept-encoding']);
    }
    $this->canGzip = false;
    $this->userAgent = str_replace(self::GZIP_UA, "", $this->userAgent);
  }
1342075
def adjust_response(self, response):
        ''

        try:
            c1 = self._replace(response.content,
                               self.header_placeholder,
                               self.embedded_holder.css)

            response.content = self._replace(c1,
                                             self.footer_placeholder,
                                             "\n".join([self.embedded_holder.config,
                                                        self.embedded_holder.scripts]))
        except AttributeError:
            # Catch the "FileResponse instance has no `content` attribute" error when serving media files in the Django development server.
            pass

        return response
809681
def parse_content_encoding(self, response_headers, response_data):
        
        if response_headers['content-encoding'] == 'gzip':
            buf = StringIO.StringIO(response_data)
            zipbuf = gzip.GzipFile(fileobj=buf)
            response_data = zipbuf.read()
        elif response_headers['content-encoding'] == 'deflate':
            data = StringIO.StringIO(zlib.decompress(response_data))
            response_data = data.read()
        else:
            raise errors.TestError(
                'Received unknown Content-Encoding',
                {
                    'content-encoding':
                        str(response_headers['content-encoding']),
                    'function': 'http.HttpResponse.parse_content_encoding'
                })
        return response_data
832064
function register (server, options, next) {
  server.ext('onPreHandler', function maybeForceGzip (request, reply) {
    if (request.query.force_gzip === 'true') {
      request.info.acceptEncoding = 'gzip'
    }
    reply.continue()
  })

  next()
}
71640
def _ready_gzip_fastq(in_files, data, require_bgzip=False):
    
    all_gzipped = all([not x or x.endswith(".gz") for x in in_files])
    if require_bgzip and all_gzipped:
        all_gzipped = all([not x or not _check_gzipped_input(x, data)[0] for x in in_files])
    needs_convert = dd.get_quality_format(data).lower() == "illumina"
    needs_trim = dd.get_trim_ends(data)
    do_splitting = dd.get_align_split_size(data) is not False
    return (all_gzipped and not needs_convert and not do_splitting and
            not objectstore.is_remote(in_files[0]) and not needs_trim and not get_downsample_params(data))
659222
def gzip(f, *args, **kwargs):
    """"""

    data = f(*args, **kwargs)

    if isinstance(data, Response):
        content = data.data
    else:
        content = data

    gzip_buffer = BytesIO()
    gzip_file = gzip2.GzipFile(
        mode='wb',
        compresslevel=4,
        fileobj=gzip_buffer
    )
    gzip_file.write(content)
    gzip_file.close()

    gzip_data = gzip_buffer.getvalue()

    if isinstance(data, Response):
        data.data = gzip_data
        data.headers['Content-Encoding'] = 'gzip'
        data.headers['Content-Length'] = str(len(data.data))

        return data

    return gzip_data
1207166
@Nonnull
  public final WSClientConfig setCompressedResponse (final boolean bCompress)
  {
    if (bCompress)
      m_aHTTPHeaders.setHeader (CHttpHeader.ACCEPT_ENCODING, "gzip");
    else
      m_aHTTPHeaders.removeHeaders (CHttpHeader.ACCEPT_ENCODING);
    return this;
  }