Uploaded image for project: 'Click'
  1. Click
  2. CLK-5

Gzip compression can cause blank pages in browsers

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      Click gzip compression of HTML can result in blank pages being displayed in some browser.

      This issue became apparent when the click-examples application was deployed with the global header set:

      <header name="Content-Encoding" value="gzip"/>

      This was first observed by Jake Robwood, and subsequently observed by some others. This was problem was not reproducable by all users. No particular browser or OS was identified as being solely associated with this issue.

      The Click compression functionality does not set the response header "Content-Length" which could be the cause of this issue. Click's compression is performed by the ClickServlet.renderTemplate() method:

      protected void renderTemplate(Page page) throws Exception {
      ..

      final HttpServletResponse response = page.getContext().getResponse();

      response.setContentType(page.getContentType());

      OutputStream output = response.getOutputStream();

      // If Page has a "Content-Encoding" "gzip" header then we can look to
      // compressing the output stream
      if (hasContentEncodingGzipHeader(page)) {

      // If client accepts gzip encoding compress output stream
      String acceptEncoding = request.getHeader("Accept-Encoding");
      if (acceptEncoding != null) {
      if (acceptEncoding.toLowerCase().indexOf("gzip") > -1)

      { output = new GZIPOutputStream(output, 4 * 1024); response.setHeader("Content-Encoding", "gzip"); }

      }
      }

      ..
      }

      Attachments

        Activity

          People

            medgar Malcolm Edgar
            medgar Malcolm Edgar
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment