Bug 18073 - gzip compression checks for wrong content type
Summary: gzip compression checks for wrong content type
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Connector:Coyote HTTP/1.1 (show other bugs)
Version: 4.1.24
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2003-03-17 16:53 UTC by Ronald Klop
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments
Add method to extract the mime type from a content type. Everything before the first ";". (835 bytes, patch)
2003-03-18 00:53 UTC, Ronald Klop
Details | Diff
Remove the charset from the content type. (628 bytes, patch)
2003-03-18 00:54 UTC, Ronald Klop
Details | Diff
New tested patch. (1.00 KB, patch)
2003-03-25 10:49 UTC, Ronald Klop
Details | Diff
New tested patch. (4.40 KB, patch)
2003-03-25 10:49 UTC, Ronald Klop
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ronald Klop 2003-03-17 16:53:35 UTC
I'm using 4.1.23 and gzip is not working if I use compression="on", but only if 
compression="force".




I think it is in this piece of code:


http11/src/java/org/apache/coyote/http11/Http11Processor.java:1130




if ((contentLength == -1)


        || (contentLength > compressionMinSize)) 


    // Check for compatible MIME-TYPE


    if (compressableMimeTypes != null)


        return (inStringArray(compressableMimeTypes,


                        response.getContentType()));


}




I don't have the possibility to compile and test everything, but I think 
response.getContentType() returns "text/html;charset=iso-8859-1" and 
inStringArray compares this to "text/html" which returns false.




And maybe bug 2820 can be closed if this works.
Comment 1 Ronald Klop 2003-03-18 00:53:46 UTC
Created attachment 5385 [details]
Add method to extract the mime type from a content type. Everything before the first ";".
Comment 2 Ronald Klop 2003-03-18 00:54:47 UTC
Created attachment 5386 [details]
Remove the charset from the content type.
Comment 3 Ronald Klop 2003-03-18 00:56:58 UTC
I've added two (untested) simple patches which might solve this problem. Can somebody look at it and commit it (or not)?
Comment 4 Ronald Klop 2003-03-25 10:49:04 UTC
Created attachment 5489 [details]
New tested patch.
Comment 5 Ronald Klop 2003-03-25 10:49:19 UTC
Created attachment 5491 [details]
New tested patch.
Comment 6 Ronald Klop 2003-03-25 10:52:01 UTC
I made two new patches which replace the first two.


These are tested and known to be working.


These patches fix the handling of content-types for gzip compression.


Is somebody willing to look at this and maybe commit it?
Comment 7 Mark Thomas 2004-03-17 23:14:22 UTC
Alternative patches have been applied (4.1.28 onwards) which should resolve 
the issues you are seeing.