Jetty
  1. Jetty
  2. JETTY-1409

GzipFilter will double-compress application/x-gzip content

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.26
    • Fix Version/s: 7.6.2, 8.1.2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The GzipFilter only excludes zipping mime-types of application/gzip.
      If a file is of type application/x-gzip it gets double-zipped, and needs to be uncompressed twice on the client.

      The following is from the Javadoc on GzipFilter:

      • The content-type is in the comma separated list of mimeTypes set in the <code>mimeTypes</code> initParameter or
      • if no mimeTypes are defined the content-type is not "application/gzip"

      This should be extended to:

      • if no mimeTypes are defined the content-type is not "application/gzip" or "application/x-gzip"

      application/x-gzip is the official mime-type for compressed files.
      And this is also what most clients will use when sending files to the server.

        Activity

        Hide
        Joakim Erdfelt added a comment -

        Some other seen content-types that indicate something is already compressed.

        application/gzip
        application/gzip-compressed
        application/gzipped
        application/x-compress
        application/x-compressed
        application/x-gunzip
        application/x-gzip
        application/x-gzip-compressed
        application/x-z
        application/z
        gzip/document

        (and some argue that application/octet-stream is something that should not be compressed by a gzip filter as well)

        Show
        Joakim Erdfelt added a comment - Some other seen content-types that indicate something is already compressed. application/gzip application/gzip-compressed application/gzipped application/x-compress application/x-compressed application/x-gunzip application/x-gzip application/x-gzip-compressed application/x-z application/z gzip/document (and some argue that application/octet-stream is something that should not be compressed by a gzip filter as well)
        Hide
        Jan Bartel added a comment -

        Nick,

        Actually the GzipFilter is checking whether on not the Content-Type has been set on the response and whether the Accept-Encoding includes "gzip" in order to determine if the content is gzippable.

        So I can't see how the file is being gzipped twice, as once the zipping starts it sets the Content-Type header, which should prevent any further entry of the filter.

        Jan

        Show
        Jan Bartel added a comment - Nick, Actually the GzipFilter is checking whether on not the Content-Type has been set on the response and whether the Accept-Encoding includes "gzip" in order to determine if the content is gzippable. So I can't see how the file is being gzipped twice, as once the zipping starts it sets the Content-Type header, which should prevent any further entry of the filter. Jan
        Hide
        Nick Pellow added a comment -

        Ok - thanks for the update, Jan.

        Does it do a case insensitive comparison as well ?

        Show
        Nick Pellow added a comment - Ok - thanks for the update, Jan. Does it do a case insensitive comparison as well ?
        Hide
        Jan Bartel added a comment -

        Nick,

        I just committed a fix for the testing of the mime-type: instead of testing if the type is "application/gzip" we now test if the Content-Type contains "gzip", which should catch more of the cases that Joakim listed earlier. Note its not going to catch all of them, but a) most of them aren't IANA registered mimetypes and b) one can always set up the filter with the extra mimetypes that signify already compressed content.

        The fix is in jetty-7 and will be rolled into jetty-8 before next release as well.

        Hope that helps,
        Jan

        Show
        Jan Bartel added a comment - Nick, I just committed a fix for the testing of the mime-type: instead of testing if the type is "application/gzip" we now test if the Content-Type contains "gzip", which should catch more of the cases that Joakim listed earlier. Note its not going to catch all of them, but a) most of them aren't IANA registered mimetypes and b) one can always set up the filter with the extra mimetypes that signify already compressed content. The fix is in jetty-7 and will be rolled into jetty-8 before next release as well. Hope that helps, Jan
        Hide
        Nick Pellow added a comment -

        Hi Jan,

        That is excellent! Thanks a lot for the fix.

        I hope we can upgrade the version of Jetty used in FishEye/Crucible soon.

        Best Regards,
        Nick Pellow.

        Show
        Nick Pellow added a comment - Hi Jan, That is excellent! Thanks a lot for the fix. I hope we can upgrade the version of Jetty used in FishEye/Crucible soon. Best Regards, Nick Pellow.
        Hide
        Jan Bartel added a comment -

        Good-o. Closing this one.
        Jan

        Show
        Jan Bartel added a comment - Good-o. Closing this one. Jan

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Nick Pellow
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: