httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject cvs commit: httpd-2.0/modules/filters mod_deflate.c
Date Wed, 05 Mar 2003 22:14:33 GMT
ianh        2003/03/05 14:14:33

  Modified:    .        CHANGES
               docs/manual/mod mod_deflate.xml
               modules/filters mod_deflate.c
  Log:
  new directive 'compressionlevel'
  Default compression level now changed to Zlib's default (was 'best_speed')
  
  Obtained from: Stephen Pierzchala <stephen@pierzchala.com> Michael Schroepl <Michael.Schroepl@telekurs.de>
  Reviewed by:  Ian Holsman
  
  Revision  Changes    Path
  1.1105    +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1104
  retrieving revision 1.1105
  diff -u -r1.1104 -r1.1105
  --- CHANGES	5 Mar 2003 16:36:59 -0000	1.1104
  +++ CHANGES	5 Mar 2003 22:14:32 -0000	1.1105
  @@ -2,6 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) you can now specify the compression level for mod_deflate. 
  +     [Ian Holsman, Stephen Pierzchala <stephen@pierzchala.com>, 
  +     Michael Schroepl <Michael.Schroepl@telekurs.de>]
  +
     *) Restore the ability of htdigest.exe to create files that contain
        more than one user. PR 12910.  [André Malo]
   
  
  
  
  1.15      +19 -0     httpd-2.0/docs/manual/mod/mod_deflate.xml
  
  Index: mod_deflate.xml
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mod_deflate.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- mod_deflate.xml	1 Jan 2003 21:13:42 -0000	1.14
  +++ mod_deflate.xml	5 Mar 2003 22:14:33 -0000	1.15
  @@ -272,6 +272,7 @@
   </directivesynopsis>
   
   <directivesynopsis>
  +
   <name>DeflateMemLevel</name>
   <description>How much memory should be used by zlib for compression</description>
   <syntax>DeflateMemLevel <var>value</var></syntax>
  @@ -285,6 +286,24 @@
       (a value between 1 and 9).</p>
   </usage>
   </directivesynopsis>
  +
  +<directivesynopsis>
  +<name>CompressionLevel</name>
  +<description>How much compression do we apply to the output</description>
  +<syntax>CompressionLevel<var>value</var></syntax>
  +<default>Zlib's default</default>
  +<contextlist><context>server config</context><context>virtual host</context>
  +</contextlist>
  +
  +<usage>
  +    <p>The <directive>CompressionLevel</directive> directive specifies
  +        what level of compression should be used, the higher the value, 
  +        the better the compression, but the more CPU time is required to
  +        achieve this.</p>
  +    <p>The value must between 1 (less compression) and 9 (more compression).</p>
  +</usage>
  +</directivesynopsis>
  +
   
   </modulesynopsis>
   
  
  
  
  1.31      +23 -1     httpd-2.0/modules/filters/mod_deflate.c
  
  Index: mod_deflate.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_deflate.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- mod_deflate.c	17 Feb 2003 04:46:00 -0000	1.30
  +++ mod_deflate.c	5 Mar 2003 22:14:33 -0000	1.31
  @@ -128,6 +128,7 @@
   {
       int windowSize;
       int memlevel;
  +    int compressionlevel;
       apr_size_t bufferSize;
       char *note_ratio_name;
       char *note_input_name;
  @@ -135,6 +136,7 @@
   } deflate_filter_config;
   
   /* windowsize is negative to suppress Zlib header */
  +#define DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION
   #define DEFAULT_WINDOWSIZE -15
   #define DEFAULT_MEMLEVEL 9
   #define DEFAULT_BUFFERSIZE 8096
  @@ -167,6 +169,7 @@
       c->memlevel   = DEFAULT_MEMLEVEL;
       c->windowSize = DEFAULT_WINDOWSIZE;
       c->bufferSize = DEFAULT_BUFFERSIZE;
  +    c->compressionlevel = DEFAULT_COMPRESSION;
   
       return c;
   }
  @@ -245,6 +248,23 @@
       return NULL;
   }
   
  +static const char *deflate_set_compressionlevel(cmd_parms *cmd, void *dummy,
  +                                        const char *arg)
  +{
  +    deflate_filter_config *c = ap_get_module_config(cmd->server->module_config,
  +                                                    &deflate_module);
  +    int i;
  +
  +    i = atoi(arg);
  +
  +    if (i < 1 || i > 9)
  +        return "Compression Level must be between 1 and 9";
  +
  +    c->compressionlevel = i;
  +
  +    return NULL;
  +}
  +
   /* magic header */
   static char deflate_magic[2] = { '\037', '\213' };
   
  @@ -354,7 +374,7 @@
           ctx->bb = apr_brigade_create(r->pool, f->c->bucket_alloc);
           ctx->buffer = apr_palloc(r->pool, c->bufferSize);
   
  -        zRC = deflateInit2(&ctx->stream, Z_BEST_SPEED, Z_DEFLATED,
  +        zRC = deflateInit2(&ctx->stream, c->compressionlevel, Z_DEFLATED,
                              c->windowSize, c->memlevel,
                              Z_DEFAULT_STRATEGY);
   
  @@ -822,6 +842,8 @@
                     "Set the Deflate Buffer Size"),
       AP_INIT_TAKE1("DeflateMemLevel", deflate_set_memlevel, NULL, RSRC_CONF,
                     "Set the Deflate Memory Level (1-9)"),
  +    AP_INIT_TAKE1("CompressionLevel", deflate_set_compressionlevel, NULL, RSRC_CONF,
  +                  "Set the Deflate Compression Level (1-9)"),
       {NULL}
   };
   
  
  
  

Mime
View raw message