Skip to content

yaoweibin/squid_gzip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This patch adds the feature of http compression on the fly for squid-2.7

=STATUS=

This patch is at its very early phase of development and considered
highly experimental. But you're encouraged to test it out on your side
and report any quirks that you experience.

We need your help! If you find this module useful and/or interesting,
please consider joining the development!

=INSTALLATION=

Get the squid-2.7 source from http://www.squid-cache.org/Versions/v2/2.7/
Get the patch from http://github.com/yaoweibin/squid_gzip

cd squid-2.7
patch -p1 < /path/to/http_gzip.patch

compile squid with the following command:

./bootstrap.sh && ./configure --enable-http-gzip && make

=EXAMPLE=
I have tested in accelerator mode.
<code>
http_gzip on
http_gzip_types text/html,text/plain
</code>

=DIRECTIVES=
    ==http_gzip==
    syntax: http_gzip on|off
    default: on
    context: main
    description: switch the http compression 

    ==http_gzip_prefer_gzip==
    syntax: http_gzip_prefer_gzip on|off
    default: on
    context: main
    description: sends gzip content to user agents who can accept both 
    gzip and deflate content.

    ==http_gzip_prefer_deflate==
    syntax: http_gzip_prefer_deflate on|off
    default: on
    context: main
    description: sends deflate content to user agents who can accept 
    both gzip and deflate content. If prefer_deflate and perfer_gzip are
    both on. deflate is higher priority than gzip.

    ==http_gzip_types==
    syntax: http_gzip_types [mime types]
    default: text/html
    context: main
    description: This directive set the MIME types list which need to be 
    compressed. The types need be separated by ',' and there should not 
    be any space between types.

    ==http_gzip_hash==
    syntax: http_gzip_hash memLevel
    default: 8
    context: main
    description: The memlevel parameter specifies how much memory should be
    allocated for the internal compression state. memLevel=1 uses minimum memory
    but is slow and reduces compression ratio; memLevel=9 uses maximum memory
    for optimal speed. 

    ==http_gzip_comp_level==
    syntax: http_gzip_comp_level level
    default: 9
    context: main
    description: The compression level, between 1 and 9, where 1 is the 
    least compression (fastest) and 9 is the most (slowest).

    ==http_gzip_min_length==
    syntax: http_gzip_min_length length
    default: 0
    context: main
    description: Sets the minimum length of of the response that will be
    compressed. Responses shorter than this will not be compressed. Length is
    determined from the "Content-Length" header.

    ==http_gzip_window==
    syntax: http_gzip_window windowBits
    default: 15
    context: main
    description: The windowBits parameter is the base two logarithm of the
    window size (the size of the history buffer). It should be in the range
    8..15 for this version of the library. Larger values of this parameter
    result in better compression at the expense of memory usage. 

    ==http_gzip_prealloc==
    syntax: http_gzip_prealloc size
    default: 256 KB
    context: main
    description:  We preallocate a memory for zlib in one buffer (default:
    256K), this decreases a number of malloc() and free() calls and also
    probably decreases a number of syscalls (sbrk()/mmap() and so on).

=TODO=

=LICENSE=

Copyright (c) 2010, Netease Inc. ( http://www.netease.com ).

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License (version 2) as
published by the Free Software Foundation.  It is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the GNU General Public License for more details.

Questions/patches may be directed to Weibin Yao, yaoweibin@gmail.com

About

add the gzip feature to squid-2.7 on the fly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published