You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Vladimir Kotikov (JIRA)" <ji...@apache.org> on 2015/09/01 11:54:46 UTC

[jira] [Commented] (CB-9427) GZip decompression doesn't work

    [ https://issues.apache.org/jira/browse/CB-9427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14725104#comment-14725104 ] 

Vladimir Kotikov commented on CB-9427:
--------------------------------------

[~abratashov], it seems that server returns incorrect headers.
In your case Content-Type should be {{application/json}}. Otherwise WebView treats response body as binary data and don't decompress it. 

Consider simple server server example below (just place it in the root of cordova application and run with node):
{noformat}
require('http').createServer(function(request, response) {
  response.writeHead(200, { 'content-encoding': 'gzip', 'content-type': 'application/gzip' });
  require('fs').createReadStream('platforms/platforms.json').pipe(require('zlib').createGzip()).pipe(response);
}).listen(1337);
{noformat}

If you try to send XHR from app, you will get a response with compressed response. Once you change  {{'content-type': 'application/gzip'}} -> {{ 'content-type': 'application/json'}} and relaunch server, the response became correct (decompressed).

> GZip decompression doesn't work
> -------------------------------
>
>                 Key: CB-9427
>                 URL: https://issues.apache.org/jira/browse/CB-9427
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 3.5.0, 4.3.0, 5.1.1
>            Reporter: Oleksandr Bratashov
>            Assignee: Vladimir Kotikov
>
> I try enable GZip compression for improve connection performance between client and server, but it seems that WebView doesn't decompress GZip-response.
> Response Header(from server) contains:
> Content-Encoding:gzip
> Content-Type:application/gzip
> Body contains compressed JSON
> On the Desktop browsers all fine,
> but if it is android device in Chrome DevTools I see compressed body.
> Mobile app doesn't decompress response body.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org