Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

mod_deflate.c File Reference

#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "apr_strings.h"
#include "apr_general.h"
#include "util_filter.h"
#include "apr_buckets.h"
#include "http_request.h"
#include "apr_want.h"
#include "zlib.h"

Include dependency graph for mod_deflate.c:

Go to the source code of this file.

Defines

#define APR_WANT_STRFUNC
#define OS_CODE   0x03
#define DEFAULT_COMPRESSION   Z_DEFAULT_COMPRESSION
#define DEFAULT_WINDOWSIZE   -15
#define DEFAULT_MEMLEVEL   9
#define DEFAULT_BUFFERSIZE   8096

Typedefs

typedef deflate_filter_config_t deflate_filter_config
typedef deflate_ctx_t deflate_ctx

Functions

static void putLong (unsigned char *string, unsigned long x)
static unsigned long getLong (unsigned char *string)
static void * create_deflate_server_config (apr_pool_t *p, server_rec *s)
static const char * deflate_set_window_size (cmd_parms *cmd, void *dummy, const char *arg)
static const char * deflate_set_buffer_size (cmd_parms *cmd, void *dummy, const char *arg)
static const char * deflate_set_note (cmd_parms *cmd, void *dummy, const char *arg1, const char *arg2)
static const char * deflate_set_memlevel (cmd_parms *cmd, void *dummy, const char *arg)
static const char * deflate_set_compressionlevel (cmd_parms *cmd, void *dummy, const char *arg)
static apr_status_t deflate_out_filter (ap_filter_t *f, apr_bucket_brigade *bb)
static apr_status_t deflate_in_filter (ap_filter_t *f, apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
static void register_hooks (apr_pool_t *p)

Variables

static const char deflateFilterName [] = "DEFLATE"
module AP_MODULE_DECLARE_DATA deflate_module
static char deflate_magic [2] = { '\037', '\213' }
static const command_rec deflate_filter_cmds []


Define Documentation

#define APR_WANT_STRFUNC
 

Definition at line 37 of file mod_deflate.c.

#define DEFAULT_BUFFERSIZE   8096
 

Definition at line 106 of file mod_deflate.c.

Referenced by create_deflate_server_config().

#define DEFAULT_COMPRESSION   Z_DEFAULT_COMPRESSION
 

Definition at line 103 of file mod_deflate.c.

Referenced by create_deflate_server_config().

#define DEFAULT_MEMLEVEL   9
 

Definition at line 105 of file mod_deflate.c.

Referenced by create_deflate_server_config().

#define DEFAULT_WINDOWSIZE   -15
 

Definition at line 104 of file mod_deflate.c.

Referenced by create_deflate_server_config().

#define OS_CODE   0x03
 

Definition at line 84 of file mod_deflate.c.

Referenced by deflate_out_filter().


Typedef Documentation

typedef struct deflate_ctx_t deflate_ctx
 

typedef struct deflate_filter_config_t deflate_filter_config
 


Function Documentation

static void* create_deflate_server_config apr_pool_t p,
server_rec s
[static]
 

Definition at line 129 of file mod_deflate.c.

References apr_pcalloc, c, DEFAULT_BUFFERSIZE, DEFAULT_COMPRESSION, DEFAULT_MEMLEVEL, and DEFAULT_WINDOWSIZE.

static apr_status_t deflate_in_filter ap_filter_t f,
apr_bucket_brigade bb,
ap_input_mode_t  mode,
apr_read_type_e  block,
apr_off_t  readbytes
[static]
 

Definition at line 585 of file mod_deflate.c.

References ap_get_module_config, AP_MODE_READBYTES, APLOG_DEBUG, APLOG_ERR, APLOG_MARK, APR_BLOCK_READ, APR_BRIGADE_CONCAT, APR_BRIGADE_EMPTY, APR_BRIGADE_FOREACH, APR_BRIGADE_INSERT_TAIL, APR_BUCKET_IS_EOS, APR_BUCKET_IS_FLUSH, apr_bucket_read, APR_BUCKET_REMOVE, APR_EGENERAL, apr_pcalloc, APR_SUCCESS, deflate_ctx_t::bb, conn_rec::bucket_alloc, deflate_ctx_t::buffer, deflate_filter_config_t::bufferSize, ap_filter_t::c, c, deflate_ctx_t::crc, ap_filter_t::ctx, ctx, deflate_magic, deflate_module, eos, getLong(), request_rec::headers_in, len, request_rec::main, server_rec::module_config, ap_filter_t::next, NULL, request_rec::pool, deflate_ctx_t::proc_bb, ap_filter_t::r, r, request_rec::server, strcasecmp(), deflate_ctx_t::stream, request_rec::uri, and deflate_filter_config_t::windowSize.

Referenced by register_hooks().

Here is the call graph for this function:

static apr_status_t deflate_out_filter ap_filter_t f,
apr_bucket_brigade bb
[static]
 

Definition at line 243 of file mod_deflate.c.

References ap_get_module_config, APLOG_DEBUG, APLOG_ERR, APLOG_MARK, APR_BLOCK_READ, APR_BRIGADE_EMPTY, APR_BRIGADE_FIRST, APR_BRIGADE_INSERT_TAIL, apr_bucket_delete, APR_BUCKET_IS_EOS, APR_BUCKET_IS_FLUSH, apr_bucket_read, APR_BUCKET_REMOVE, APR_EGENERAL, apr_pcalloc, APR_SUCCESS, b, deflate_ctx_t::bb, buf, deflate_ctx_t::buffer, deflate_filter_config_t::bufferSize, c, deflate_filter_config_t::compressionlevel, request_rec::content_encoding, request_rec::content_type, deflate_ctx_t::crc, ctx, deflate_magic, deflate_module, done, e, request_rec::err_headers_out, request_rec::headers_in, request_rec::headers_out, len, request_rec::main, deflate_filter_config_t::memlevel, server_rec::module_config, deflate_filter_config_t::note_input_name, deflate_filter_config_t::note_output_name, deflate_filter_config_t::note_ratio_name, request_rec::notes, NULL, OS_CODE, request_rec::pool, putLong(), r, request_rec::server, strcasecmp(), deflate_ctx_t::stream, request_rec::subprocess_env, request_rec::uri, and deflate_filter_config_t::windowSize.

Referenced by register_hooks().

Here is the call graph for this function:

static const char* deflate_set_buffer_size cmd_parms cmd,
void *  dummy,
const char *  arg
[static]
 

Definition at line 158 of file mod_deflate.c.

References ap_get_module_config, deflate_filter_config_t::bufferSize, c, deflate_module, n, and NULL.

static const char* deflate_set_compressionlevel cmd_parms cmd,
void *  dummy,
const char *  arg
[static]
 

Definition at line 215 of file mod_deflate.c.

References ap_get_module_config, c, deflate_filter_config_t::compressionlevel, deflate_module, and NULL.

static const char* deflate_set_memlevel cmd_parms cmd,
void *  dummy,
const char *  arg
[static]
 

Definition at line 198 of file mod_deflate.c.

References ap_get_module_config, c, deflate_module, deflate_filter_config_t::memlevel, server_rec::module_config, NULL, and cmd_parms_struct::server.

static const char* deflate_set_note cmd_parms cmd,
void *  dummy,
const char *  arg1,
const char *  arg2
[static]
 

Definition at line 173 of file mod_deflate.c.

References ap_get_module_config, c, deflate_module, server_rec::module_config, deflate_filter_config_t::note_input_name, deflate_filter_config_t::note_output_name, deflate_filter_config_t::note_ratio_name, NULL, cmd_parms_struct::pool, cmd_parms_struct::server, and strcasecmp().

Here is the call graph for this function:

static const char* deflate_set_window_size cmd_parms cmd,
void *  dummy,
const char *  arg
[static]
 

Definition at line 141 of file mod_deflate.c.

References ap_get_module_config, c, deflate_module, server_rec::module_config, NULL, cmd_parms_struct::server, and deflate_filter_config_t::windowSize.

static unsigned long getLong unsigned char *  string  )  [static]
 

Definition at line 121 of file mod_deflate.c.

Referenced by deflate_in_filter().

static void putLong unsigned char *  string,
unsigned long  x
[static]
 

Definition at line 111 of file mod_deflate.c.

Referenced by deflate_out_filter().

static void register_hooks apr_pool_t p  )  [static]
 

Definition at line 845 of file mod_deflate.c.

References AP_FTYPE_CONTENT_SET, deflate_in_filter(), deflate_out_filter(), deflateFilterName, and NULL.

Here is the call graph for this function:


Variable Documentation

const command_rec deflate_filter_cmds[] [static]
 

Initial value:

 {
    AP_INIT_TAKE12("DeflateFilterNote", deflate_set_note, NULL, RSRC_CONF,
                  "Set a note to report on compression ratio"),
    AP_INIT_TAKE1("DeflateWindowSize", deflate_set_window_size, NULL,
                  RSRC_CONF, "Set the Deflate window size (1-15)"),
    AP_INIT_TAKE1("DeflateBufferSize", deflate_set_buffer_size, NULL, RSRC_CONF,
                  "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("DeflateCompressionLevel", deflate_set_compressionlevel, NULL, RSRC_CONF,
                  "Set the Deflate Compression Level (1-9)"),
    {NULL}
}

Definition at line 853 of file mod_deflate.c.

char deflate_magic[2] = { '\037', '\213' } [static]
 

Definition at line 233 of file mod_deflate.c.

Referenced by deflate_in_filter(), and deflate_out_filter().

module AP_MODULE_DECLARE_DATA deflate_module
 

Initial value:

Definition at line 867 of file mod_deflate.c.

Referenced by deflate_in_filter(), deflate_out_filter(), deflate_set_buffer_size(), deflate_set_compressionlevel(), deflate_set_memlevel(), deflate_set_note(), and deflate_set_window_size().

const char deflateFilterName[] = "DEFLATE" [static]
 

Definition at line 88 of file mod_deflate.c.

Referenced by register_hooks().