From 80bf8d998f281625f3b9f06dc09fbe33d658eb34 Mon Sep 17 00:00:00 2001 From: Andre Malo Date: Mon, 11 Nov 2002 03:40:26 +0000 Subject: [PATCH] update transformation git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97480 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/index.html.en | 4 +- docs/manual/mod/mod_deflate.html.en | 255 +++++++++++++++++++++---- docs/manual/mod/quickreference.html.en | 10 +- 3 files changed, 224 insertions(+), 45 deletions(-) diff --git a/docs/manual/mod/index.html.en b/docs/manual/mod/index.html.en index d8eb56d874..9e81484333 100644 --- a/docs/manual/mod/index.html.en +++ b/docs/manual/mod/index.html.en @@ -55,8 +55,8 @@ address)
mod_charset_lite
Specify character set translation or recoding
mod_dav
Distributed Authoring and Versioning (WebDAV) functionality
-
mod_deflate
Compress content before - it is delivered to the client
+
mod_deflate
Compress content before it is delivered to the +client
mod_dir
Provides for "trailing slash" redirects and serving directory index files
mod_echo
A simple echo server to illustrate protocol diff --git a/docs/manual/mod/mod_deflate.html.en b/docs/manual/mod/mod_deflate.html.en index 3444d02f87..09dd4abd14 100644 --- a/docs/manual/mod/mod_deflate.html.en +++ b/docs/manual/mod/mod_deflate.html.en @@ -5,8 +5,8 @@ This file is generated from xml source: DO NOT EDIT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->mod_deflate - Apache HTTP Server
<-

Apache Module mod_deflate

Description: - Compress content before - it is delivered to the client
Status: + Compress content before it is delivered to the +client
Status: Extension
Module Identifier: deflate_module
Source File: mod_deflate.c

Summary

@@ -18,38 +18,208 @@
  • DeflateFilterNote
  • DeflateMemLevel
  • DeflateWindowSize
  • -

    Topics

    • Enabling Compression

    See also

    top

    Enabling Compression

    - -

    Compression is implemented by the DEFLATE - filter. The following directive - will enable compression for documents in the container where it - is placed:

    -

    Most popular browsers can not handle compression of all content - so you may want to set the 'gzip-only-text/html' note to 1 to only - allow html files to be compressed (see below).

    -

    If you set this to anything but '1' it will be ignored, so you can do - negative matches.

    - -

    SetEnv gzip-only-text/html 1
    -SetOutputFilter DEFLATE -

    - -

    Here is an example of enabling compression for the Apache - documentation:

    - -

    -<Directory "/your-server-root/manual">
    - SetEnv gzip-only-text/html 1
    - SetOutputFilter DEFLATE
    -</Directory> -

    - -

    For browsers that have problems even with compression of html files, - use the BrowserMatch directive to set the 'no-gzip' note - for that particular browser so that no compression will be performed.

    +

    Topics

    See also

    top

    Recommended Configuration

    +

    This is a sample configuration for the impatient. But please take + the time and read the sections below for a detailed description!

    + +

    + <Location />
    + + # insert filter
    + SetOutputFilter DEFLATE
    +
    + # Netscape 4.x has some problems...
    + BrowserMatch ^Mozilla/4 gzip-only-text/html
    +
    + # Netscape 4.06-4.08 have some more problems
    + BrowserMatch ^Mozilla/4\.0[678] no-gzip
    +
    + # fix identity
    + BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    +
    + # don't bother:
    + SetEnvIfNoCase Request_URI \
    + + \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    +
    +
    + # be verbose about configuration
    + Header append Vary User-Agent env=!dont-vary
    +
    + </Location> +

    + +

    Note, that gzip compression of binary files (e.g. images) + usually has only little effect. Therefore in the example above we use + an exclusion list of some file types. Alternatively you may use a + positive list using AddOutputFilter or AddOutputFilterByType instead of the SetOutputFilter directive.

    +
    top

    Enabling Compression

    + +

    Output Compression

    +

    Compression is implemented by the DEFLATE + filter. The following directive + will enable compression for documents in the container where it + is placed:

    + +

    + SetOutputFilter DEFLATE +

    + +

    Some popular browsers cannot handle compression of all content + so you may want to set the gzip-only-text/html note to + 1 to only allow html files to be compressed (see + below). If you set this to anything but 1 it + will be ignored.

    + +

    If you want to restrict the compression to particular MIME types + in general, you may use the AddOutputFilterByType directive. Here is an example of + enabling compression only for the html files of the Apache + documentation:

    + +

    + <Directory "/your-server-root/manual">
    + + AddOutputFilterByType DEFLATE text/html
    +
    + </Directory> +

    + +

    For browsers that have problems even with compression of all file + types, use the BrowserMatch directive to set the no-gzip + note for that particular browser so that no compression will be + performed. You may combine no-gzip with gzip-only-text/html to get the best results. In that case + the former overrides the latter. Take a look at the following + excerpt from the configuration example + defined in the section above:

    + +

    + BrowserMatch ^Mozilla/4 gzip-only-text/html
    + BrowserMatch ^Mozilla/4\.0[678] no-gzip
    + BrowserMatch \bMSIE !no-gzip !gzip-only-text/html +

    + +

    At first we probe for a User-Agent string that + indicates a Netscape Navigator version of 4.x. These versions + have some big problems to decompress content types different + from text/html. The versions 4.06, 4.07 and 4.08 have + also sometimes problems to decompress html files. Thus, we + completely turn off the deflate filter for them.

    + +

    The third BrowserMatch + directive fixes the guessed identity of the user agent, because + the Microsoft Internet Explorer identifies itself also as "Mozilla/4" + but is actually able to handle requested compression. Therefore we + match against the additional string "MSIE" (\b means + "word boundary") in the User-Agent Header and turn off + the restrictions defined before.

    + +

    Note

    + The DEFLATE filter is always inserted after RESOURCE + filters like PHP or SSI. It never touches internal subrequests. +
    + + +

    Input Decompression

    +

    The mod_deflate module also provides a filter for + decompressing a gzip compressed request body . In order to activate + this feature you have to insert the DEFLATE filter into + the input filter chain using SetInputFilter or AddInputFilter, for example:

    + +

    + <Location /dav-area> + + SetInputFilter DEFLATE + + </Location> +

    + +

    Now if a request contains a Content-Encoding: gzip + header, the body will be automatically decompressed. Ordinary + browsers usually don't have the ability to gzip e.g. POST + request bodies. However, some special applications actually do + support request compression, for instance WebDAV clients.

    + +

    Note on Content-Length

    +

    If you evaluate the request body yourself, don't trust + the Content-Length header! For example, a + wide-spread code to read the request body in perl is:

    + +

    + # WRONG!
    + if (($len = $ENV{'CONTENT_LENGTH'}) > 0) {
    + + read(STDIN, $body, $len);
    +
    + } +

    + +

    Since the Content-Length header reflects the length of the + incoming data from the client and not the byte count of + the decompressed data, you would read too less and cut off the + stream.

    + +

    Thus, if you want to slurp the whole request body, use for + example:

    + +

    + {
    + + local $/; # undef input record separator
    + $body = <STDIN>;
    +
    + } +

    +
    + +
    top

    Dealing with proxy servers

    +

    Since the DEFLATE output filter actually performs a + kind of content negotiation, + you should take care of caching proxy servers. In order to prevent a + proxy cache from delivering the wrong data (e.g. gzip + compressed data to a client which doesn't send an appropriate + Accept-Encoding header), the origin server + (i.e. you) has to indicate the negotiation parameters in the + Vary response header.

    + +

    If the DEFLATE filter is involved in the request, the + following header will be set:

    + +

    + Vary: Accept-Encoding +

    + +

    A HTTP compiliant proxy now delivers the cached data to any client, + which sends the same Accept-Encoding header as + the client, which did the initial request that was cached.

    + +

    Fine. But what happens, if you use some special exclusions dependant + on, say the User-Agent header? The proxy server doesn't + know anything about your server configuration, thus you have to tell + him, what you're doing. You have to use the mod_headers + module to add appropriate values to the Vary header, for + example:

    + +

    + Header append Vary User-Agent +

    + +

    would result in the following response header:

    + +

    + Vary: Accept-Encoding,User-Agent +

    + +

    If your decision about compression depends on other information + than request headers (e.g. HTTP version), you have to set the + Vary header to the value *. This prevents + documents from caching by HTTP compiliant proxies at all.

    + +

    Example

    + Header set Vary * +

    top

    DeflateBufferSize Directive

    Description: Fragment size to be compressed at one time by zlib
    Syntax: - DeflateBufferSize value
    Default: + DeflateBufferSize value
    Default: DeflateBufferSize 8096
    Context: server config, virtual host
    Status: Extension
    Module: @@ -59,17 +229,25 @@ SetOutputFilter DEFLATE time.

    top

    DeflateFilterNote Directive

    Description: Places the compression ratio in a note for logging
    Syntax: - DeflateFilterNote notename
    Context: + DeflateFilterNote notename
    Context: server config, virtual host
    Status: Extension
    Module: mod_deflate

    The DeflateFilterNote directive specifies that a note about compression ratios should be attached to the request. The name of the note is the value specified for - the directive.

    -
    top

    DeflateMemLevel Directive

    Description: + the directive. You can use that note for statistical purposes by + adding the value to your access log.

    + +

    Example

    + DeflateFilterNote ratio
    +
    + LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
    + CustomLog logs/deflate_log deflate +

    +

    See also

    top

    DeflateMemLevel Directive

    specified language - - - - + + + +local-url [local-url] ...
    Description: How much memory should be used by zlib for compression
    Syntax: - DeflateMemLevel value
    Default: + DeflateMemLevel value
    Default: DeflateMemLevel 9
    Context: server config, virtual host
    Status: Extension
    Module: @@ -79,11 +257,12 @@ SetOutputFilter DEFLATE (a value between 1 and 9).

    top

    DeflateWindowSize Directive

    Description: Zlib compression window size
    Syntax: - DeflateWindowSize value
    Default: + DeflateWindowSize value
    Default: DeflateWindowSize 15
    Context: server config, virtual host
    Status: Extension
    Module: mod_deflate

    The DeflateWindowSize directive specifies the - zlib compression window size (a value between 1 and 15).

    + zlib compression window size (a value between 1 and 15). Generally, the + higher the window size, the higher can the compression ratio be expected.

    \ No newline at end of file diff --git a/docs/manual/mod/quickreference.html.en b/docs/manual/mod/quickreference.html.en index 798cc68e7d..a94a8b258d 100644 --- a/docs/manual/mod/quickreference.html.en +++ b/docs/manual/mod/quickreference.html.en @@ -219,10 +219,10 @@ configured
    DefaultType MIME-type text/plain svdhC
    MIME content-type that will be sent if the server cannot determine a type in any other way
    DeflateBufferSize value 8096 svE
    Fragment size to be compressed at one time by zlib
    DeflateFilterNote notenamesvE
    Places the compression ratio in a note for logging
    DeflateMemLevel value 9 svE
    How much memory should be used by zlib for compression
    DeflateWindowSize value 15 svE
    Zlib compression window size
    DeflateBufferSize value 8096 svE
    Fragment size to be compressed at one time by zlib
    DeflateFilterNote notenamesvE
    Places the compression ratio in a note for logging
    DeflateMemLevel value 9 svE
    How much memory should be used by zlib for compression
    DeflateWindowSize value 15 svE
    Zlib compression window size
    Deny from all|host|env=env-variable [host|env=env-variable] ...dhB
    Controls which hosts are denied access to the @@ -234,7 +234,7 @@ named file-system directory and sub-directories
    index.html svdhB
    List of resources to look for when the client requests a directory
    <DirectoryMatch regex> -... </Directory>svC
    Enclose directives that apply to +... </DirectoryMatch>svC
    Enclose directives that apply to file-system directories matching a regular expression and their subdirectories
    DocumentRoot directory-path /usr/local/apache/h +svC
    Directory that forms the main document tree visible -- 2.50.1