Search Issue Tracker

By Design



Found in


Issue ID




[Windows] UnityWebRequest and WWW not handling Content-Encoding header



How to reproduce:
1. Download attached project and open "Launcher" Scene
2. Enter Play mode and hit "Start Request" button with "Use GZIP" checkbox checked (You can see a log with Content-Encoding: gzip, but "Received content" is still gzipped. (Start with 0x1f 0x8b ...) )
3. Uncheck "Use GZIP" and request again (you can see right data content print in the log)

Expected result: Get uncompressed data in log whether or not you check/uncheck "Use GZIP".
Actual result: UnityWebRequest and WWW cannot handle Content-Encoding header in Windows, but works in macOS.

Note: If use macOS, you can see right data content in log (uncompressed) with/without "Use GZIP" checked

Reproduced with: 5.6.5f1, 2017.1.3p1, 2017.2.1p3, 2017.3.1p1, 2018.1.0b6

By Design: Supported content encodings are platform specific.
WWW is a wrapper on top of UnityWebRequest, which has it documented here:

Comments (3)

  1. Cd780dd1563106cae461708b88bbe86b?d=mm


    Jan 26, 2019 19:01

    I just want to point out that:

    1. You say it's documented, and provided a link, and the letters "gzip" do not appear in your link, so clearly the behavior that everyone's observing with gzip only being supported on some platforms is not documented.
    2. On your latest scripting runtime, there is gzip compression written in C#:

    UnityWebRequest www;
    string text;
    if (www.GetResponseHeader("Content-Encoding") == "gzip"
    && Application.platform == RuntimePlatform.WindowsPlayer)
    // GZipStream is from System.IO.Compression in .Net 4.5+
    var stream = new StreamReader(new GZipStream(new MemoryStream(,
    text = stream.ReadToEnd();
    text = www.downloadHandler.text;

    // Do what you need to do with the text

    // Don't forget to dispose the download handler

  2. 4b502cdc2ebb67079b08718fd034eda2?d=mm


    Feb 09, 2018 03:37

    Or maybe you can have a callback that letting developers to handle content-encoding which you can not handle.

  3. 4b502cdc2ebb67079b08718fd034eda2?d=mm


    Feb 09, 2018 03:30

    Ok but some CDN server send Content-Encoding back with gzip even you did not set Accept-Encoding and UnityWebRequest.GetAssetBundle will go wrong.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.