Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#5313 closed (fixed)

GZipMiddleware should compress javascript

Reported by: mgiger@… Owned by: nobody
Component: HTTP handling Version: master
Severity: Keywords: gzip javascript
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Only really old versions of Internet Explorer have problems with javascript compression anymore. Even Yahoo and Google compress their javascript now. Here is a simple one line patch to maintain compatibility with older versions of explorer while allowing gzip compression of javascript.

Attachments (3)

gzipdiff.diff (647 bytes) - added by mgiger@… 9 years ago.
js_gzip.diff (671 bytes) - added by jmelesky 9 years ago.
updated patch
js_gzip.2.diff (671 bytes) - added by jmelesky 9 years ago.
against [6332]

Download all attachments as: .zip

Change History (9)

Changed 9 years ago by mgiger@…

comment:1 Changed 9 years ago by SmileyChris

  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 9 years ago by Simon G. <dev@…>

  • Triage Stage changed from Design decision needed to Ready for checkin

comment:3 Changed 9 years ago by Fredrik Lundh <fredrik@…>

I suggest changing

request.META.get('HTTP_USER_AGENT', '').find('MSIE') != -1


"MSIE" in request.META.get('HTTP_USER_AGENT', '')

Changed 9 years ago by jmelesky

updated patch

Changed 9 years ago by jmelesky

against [6332]

comment:4 Changed 9 years ago by Simon Law <simon@…>

You should note that "content-type" has to spelled in lowercase, if you're using request.get().

See #5772.

comment:5 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [6538]) Fixed #5313 -- Only avoid compressing Javascript when the user agent says it's Internet Explorer. Thanks, mgiger@….

comment:6 Changed 8 years ago by gwilson

(In [6697]) Made some stylistic changes in GZipMiddleware and added some notes about IE, refs #5313.

Note: See TracTickets for help on using tickets.
Back to Top