comparison src/http/modules/ngx_http_gzip_filter_module.c @ 230:38e7b94d63ac NGINX_0_4_0

nginx 0.4.0 *) Change in internal API: the HTTP modules initialization was moved from the init module phase to the HTTP postconfiguration phase. *) Change: now the request body is not read beforehand for the ngx_http_perl_module: it's required to start the reading using the $r->has_request_body method. *) Feature: the ngx_http_perl_module supports the DECLINED return code. *) Feature: the ngx_http_dav_module supports the incoming "Date" header line for the PUT method. *) Feature: the "ssi" directive is available inside the "if" block. *) Bugfix: a segmentation fault occurred if there was an "index" directive with variables and the first index name was without variables; bug appeared in 0.1.29.
author Igor Sysoev <http://sysoev.ru>
date Wed, 30 Aug 2006 00:00:00 +0400
parents 56688ed172c8
children 0effe91f6083
comparison
equal deleted inserted replaced
229:1965c8e23be7 230:38e7b94d63ac
81 81
82 static ngx_int_t ngx_http_gzip_add_variables(ngx_conf_t *cf); 82 static ngx_int_t ngx_http_gzip_add_variables(ngx_conf_t *cf);
83 static ngx_int_t ngx_http_gzip_ratio_variable(ngx_http_request_t *r, 83 static ngx_int_t ngx_http_gzip_ratio_variable(ngx_http_request_t *r,
84 ngx_http_variable_value_t *v, uintptr_t data); 84 ngx_http_variable_value_t *v, uintptr_t data);
85 85
86 static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle); 86 static ngx_int_t ngx_http_gzip_filter_init(ngx_conf_t *cf);
87 static void *ngx_http_gzip_create_conf(ngx_conf_t *cf); 87 static void *ngx_http_gzip_create_conf(ngx_conf_t *cf);
88 static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf, 88 static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
89 void *parent, void *child); 89 void *parent, void *child);
90 static char *ngx_http_gzip_types(ngx_conf_t *cf, ngx_command_t *cmd, 90 static char *ngx_http_gzip_types(ngx_conf_t *cf, ngx_command_t *cmd,
91 void *conf); 91 void *conf);
199 }; 199 };
200 200
201 201
202 static ngx_http_module_t ngx_http_gzip_filter_module_ctx = { 202 static ngx_http_module_t ngx_http_gzip_filter_module_ctx = {
203 ngx_http_gzip_add_variables, /* preconfiguration */ 203 ngx_http_gzip_add_variables, /* preconfiguration */
204 NULL, /* postconfiguration */ 204 ngx_http_gzip_filter_init, /* postconfiguration */
205 205
206 NULL, /* create main configuration */ 206 NULL, /* create main configuration */
207 NULL, /* init main configuration */ 207 NULL, /* init main configuration */
208 208
209 NULL, /* create server configuration */ 209 NULL, /* create server configuration */
218 NGX_MODULE_V1, 218 NGX_MODULE_V1,
219 &ngx_http_gzip_filter_module_ctx, /* module context */ 219 &ngx_http_gzip_filter_module_ctx, /* module context */
220 ngx_http_gzip_filter_commands, /* module directives */ 220 ngx_http_gzip_filter_commands, /* module directives */
221 NGX_HTTP_MODULE, /* module type */ 221 NGX_HTTP_MODULE, /* module type */
222 NULL, /* init master */ 222 NULL, /* init master */
223 ngx_http_gzip_filter_init, /* init module */ 223 NULL, /* init module */
224 NULL, /* init process */ 224 NULL, /* init process */
225 NULL, /* init thread */ 225 NULL, /* init thread */
226 NULL, /* exit thread */ 226 NULL, /* exit thread */
227 NULL, /* exit process */ 227 NULL, /* exit process */
228 NULL, /* exit master */ 228 NULL, /* exit master */
1028 1028
1029 return NGX_OK; 1029 return NGX_OK;
1030 } 1030 }
1031 1031
1032 1032
1033 static ngx_int_t
1034 ngx_http_gzip_filter_init(ngx_cycle_t *cycle)
1035 {
1036 ngx_http_next_header_filter = ngx_http_top_header_filter;
1037 ngx_http_top_header_filter = ngx_http_gzip_header_filter;
1038
1039 ngx_http_next_body_filter = ngx_http_top_body_filter;
1040 ngx_http_top_body_filter = ngx_http_gzip_body_filter;
1041
1042 return NGX_OK;
1043 }
1044
1045
1046 static void * 1033 static void *
1047 ngx_http_gzip_create_conf(ngx_conf_t *cf) 1034 ngx_http_gzip_create_conf(ngx_conf_t *cf)
1048 { 1035 {
1049 ngx_http_gzip_conf_t *conf; 1036 ngx_http_gzip_conf_t *conf;
1050 1037
1121 1108
1122 return NGX_CONF_OK; 1109 return NGX_CONF_OK;
1123 } 1110 }
1124 1111
1125 1112
1113 static ngx_int_t
1114 ngx_http_gzip_filter_init(ngx_conf_t *cf)
1115 {
1116 ngx_http_next_header_filter = ngx_http_top_header_filter;
1117 ngx_http_top_header_filter = ngx_http_gzip_header_filter;
1118
1119 ngx_http_next_body_filter = ngx_http_top_body_filter;
1120 ngx_http_top_body_filter = ngx_http_gzip_body_filter;
1121
1122 return NGX_OK;
1123 }
1124
1125
1126 static char * 1126 static char *
1127 ngx_http_gzip_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 1127 ngx_http_gzip_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1128 { 1128 {
1129 ngx_http_gzip_conf_t *gcf = conf; 1129 ngx_http_gzip_conf_t *gcf = conf;
1130 1130