comparison src/http/ngx_http_output_filter.c @ 44:0e81ac0bb3e2

nginx-0.0.1-2003-01-09-08:36:00 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 09 Jan 2003 05:36:00 +0000
parents 53cd05892261
children f1ee46c036a4
comparison
equal deleted inserted replaced
43:53cd05892261 44:0e81ac0bb3e2
12 #include <ngx_http_output_filter.h> 12 #include <ngx_http_output_filter.h>
13 13
14 14
15 static int ngx_http_output_filter_copy_hunk(ngx_hunk_t *dst, ngx_hunk_t *src); 15 static int ngx_http_output_filter_copy_hunk(ngx_hunk_t *dst, ngx_hunk_t *src);
16 static void *ngx_http_output_filter_create_conf(ngx_pool_t *pool); 16 static void *ngx_http_output_filter_create_conf(ngx_pool_t *pool);
17 static char *ngx_http_output_filter_merge_conf(ngx_pool_t *pool,
18 void *parent, void *child);
17 19
18 20
19 static ngx_command_t ngx_http_output_filter_commands[] = { 21 static ngx_command_t ngx_http_output_filter_commands[] = {
20 22
21 {ngx_string("output_buffer"), 23 {ngx_string("output_buffer"),
22 NGX_CONF_TAKE1, 24 NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE1,
23 ngx_conf_set_size_slot, 25 ngx_conf_set_size_slot,
24 NGX_HTTP_LOC_CONF, 26 NGX_HTTP_LOC_CONF_OFFSET,
25 offsetof(ngx_http_output_filter_conf_t, hunk_size)}, 27 offsetof(ngx_http_output_filter_conf_t, hunk_size)},
26 28
27 {ngx_string(""), 0, NULL, 0, 0} 29 {ngx_string(""), 0, NULL, 0, 0}
28 }; 30 };
29 31
32 NGX_HTTP_MODULE, 34 NGX_HTTP_MODULE,
33 35
34 NULL, /* create server config */ 36 NULL, /* create server config */
35 NULL, /* init server config */ 37 NULL, /* init server config */
36 ngx_http_output_filter_create_conf, /* create location config */ 38 ngx_http_output_filter_create_conf, /* create location config */
37 NULL, /* merge location config */ 39 ngx_http_output_filter_merge_conf, /* merge location config */
38 40
39 NULL, /* translate handler */ 41 NULL, /* translate handler */
40 42
41 NULL, /* output header filter */ 43 NULL, /* output header filter */
42 NULL, /* next output header filter */ 44 NULL, /* next output header filter */
45 NULL /* next output body filter */ 47 NULL /* next output body filter */
46 }; 48 };
47 49
48 50
49 ngx_module_t ngx_http_output_filter_module = { 51 ngx_module_t ngx_http_output_filter_module = {
52 0, /* module index */
50 &ngx_http_output_filter_module_ctx, /* module context */ 53 &ngx_http_output_filter_module_ctx, /* module context */
51 ngx_http_output_filter_commands, /* module directives */ 54 ngx_http_output_filter_commands, /* module directives */
52 NGX_HTTP_MODULE_TYPE, /* module type */ 55 NGX_HTTP_MODULE_TYPE, /* module type */
53 NULL /* init module */ 56 NULL /* init module */
54 }; 57 };
247 250
248 if (rc == NGX_OK) { 251 if (rc == NGX_OK) {
249 if (ctx->hunk) { 252 if (ctx->hunk) {
250 ctx->hunk->pos.mem = ctx->hunk->last.mem = ctx->hunk->start; 253 ctx->hunk->pos.mem = ctx->hunk->last.mem = ctx->hunk->start;
251 } 254 }
252 #if (!NGX_ONESHOT_EVENT) 255 #if (NGX_LEVEL_EVENT)
253 ngx_del_event(r->connection->write, NGX_WRITE_EVENT); 256 ngx_del_event(r->connection->write, NGX_WRITE_EVENT);
254 #endif 257 #endif
255 } 258 }
256 259
257 return rc; 260 return rc;
313 316
314 conf->hunk_size = NGX_CONF_UNSET; 317 conf->hunk_size = NGX_CONF_UNSET;
315 318
316 return conf; 319 return conf;
317 } 320 }
321
322
323 static char *ngx_http_output_filter_merge_conf(ngx_pool_t *pool,
324 void *parent, void *child)
325 {
326 ngx_http_output_filter_conf_t *prev =
327 (ngx_http_output_filter_conf_t *) parent;
328 ngx_http_output_filter_conf_t *conf =
329 (ngx_http_output_filter_conf_t *) child;
330
331 ngx_conf_merge(conf->hunk_size, prev->hunk_size, 32768);
332
333 return NULL;
334 }