https://issues.apache.org/bugzilla/show_bug.cgi?id=47136

           Summary: Tomcat Compression limited to 48K
           Product: Tomcat 6
           Version: 6.0.18
          Platform: PC
               URL: N/A
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: ar...@yahoo.com


CONFIGURATION

Windows XP (SP3)
Apache Tomcat 6.0.18
Java 1.6.0_13-b03

SPECIAL TOMCAT SETTINGS

Set on the Connector: 

    compression="force"

   
compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,
        text/json,application/json"

    noCompressionUserAgents="gozilla, traviata"

TEST CASE

1). Create a file exactly 48K in size somewhere in your tomcat structure that
is accessible to the outside.

2). Execute the following CURL command.  (CURL required)

curl -s -o nul: -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "  Bytes
Uncompressed ... %{size_download}\n" <INSERT URL TO FILE HERE>

3). Make a note of the uncompressed file size.

4). Execute the following CURL command.

curl -s -o nul: -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "  Bytes
Uncompressed ... %{size_download}\n" --compressed <INSERT URL TO FILE HERE>

5). Make a note of the compressed file size.

6). Add exactly one byte the file from step #1.

7). Wait 10 seconds or so to allow your tomcat install time to notice the
changed file.

8). Execute the following CURL command.  (CURL required)

curl -s -o nul: -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "  Bytes
Uncompressed ... %%{size_download}\n" <INSERT URL TO FILE HERE>

9). Make a note of the uncompressed file size.

10). Execute the following CURL command.

curl -s -o nul: -H "Pragma: no-cache" -H "Cache-Control: no-cache" -w "  Bytes
Uncompressed ... %%{size_download}\n" --compressed <INSERT URL TO FILE HERE>

11). Make a note of the compressed file size.

OBSERVATION

The uncompressed and compressed numbers from steps 3 and 5 are different, as
expected.  The uncompressed and compressed numbers from steps 7 and 9 are the
same.  This indicates that for any file in excess of 49152 bytes (exactly 48k),
compression is not being used.

DESIRED RESULTS

Compression should be used regardless of file size.

TEST SCRIPT

I have included a sample Batch Script which will perform this test case.  The
script will run on Windowx XP and requires CURL and PING installed and
configured into the PATH.

@ECHO off

REM SETUP VARS
SET FILENAME=test.css
SET CURLOPTS=-s -o nul: -H "Pragma: no-cache" -H "Cache-Control: no-cache"
SET URL=localhost/idp/%FILENAME%

echo.
echo Performing Test Case for 48K Maximum Size Limit on Tomcat Compression.
echo.
echo Please be patient during test as some test may take a minute or so echo to
run to completion.

echo.
echo Testing file of 48k...
DEL %FILENAME% /Q > nul: 2>&1
call :writefirst
call :wait 10
call :test

echo. 
echo Testing file of 48k plus 1 byte.
DEL %FILENAME% /Q > nul: 2>&1
call :writesecond
call :wait 10
call :test

del %FILENAME% /y > nul: 2>&1

echo.
echo Test Complete.
GOTO :EOF

REM Function for performing the test.
:test
CURL %CURLOPTS% -w "  Bytes Uncompressed ... %%{size_download}\n" %URL% CURL
%CURLOPTS% -w "  Bytes Compressed ..... %%{size_download}\n" --compressed %URL%
GOTO :EOF

REM Function for waiting N seconds, requires PING in the path.  N is specified
in the %1 parameter :wait PING 127.0.0.1 -n %1 -w 1000 > nul GOTO :EOF

:writefirst
call :writesixteenk
call :writesixteenk
call :writesixteenk
goto :EOF

:writesecond
call :writesixteenk
call :writesixteenk
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
echo //twelve bytes-twelve bytes-twelve bytes-twelve
bytes.........1>>%FILENAME% goto :EOF

:writesixteenk
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
call :writeonek
goto :EOF

:writeonek
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
call :writesixtyfourbytes
:goto EOF

:writesixtyfourbytes
echo //twelve bytes-twelve bytes-twelve bytes-twelve bytes.........>>%FILENAME%
goto :EOF

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to