Mercurial > hg > nginx
comparison src/http/ngx_http_output_filter.c @ 71:59229033ae93
nginx-0.0.1-2003-04-08-19:40:10 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 08 Apr 2003 15:40:10 +0000 |
parents | e43f406e4525 |
children | 869b10be682f |
comparison
equal
deleted
inserted
replaced
70:e320bf51c4e3 | 71:59229033ae93 |
---|---|
31 {ngx_null_string, 0, NULL, 0, 0} | 31 {ngx_null_string, 0, NULL, 0, 0} |
32 }; | 32 }; |
33 | 33 |
34 | 34 |
35 static ngx_http_module_t ngx_http_output_filter_module_ctx = { | 35 static ngx_http_module_t ngx_http_output_filter_module_ctx = { |
36 NGX_HTTP_MODULE, | |
37 | |
36 NULL, /* create server config */ | 38 NULL, /* create server config */ |
37 NULL, /* init server config */ | 39 NULL, /* init server config */ |
38 | 40 |
39 ngx_http_output_filter_create_conf, /* create location config */ | 41 ngx_http_output_filter_create_conf, /* create location config */ |
40 ngx_http_output_filter_merge_conf, /* merge location config */ | 42 ngx_http_output_filter_merge_conf /* merge location config */ |
41 | |
42 ngx_http_output_filter_init /* output body filter */ | |
43 }; | 43 }; |
44 | 44 |
45 | 45 |
46 ngx_module_t ngx_http_output_filter_module = { | 46 ngx_module_t ngx_http_output_filter_module = { |
47 0, /* module index */ | 47 0, /* module index */ |
50 NGX_HTTP_MODULE_TYPE, /* module type */ | 50 NGX_HTTP_MODULE_TYPE, /* module type */ |
51 NULL /* init module */ | 51 NULL /* init module */ |
52 }; | 52 }; |
53 | 53 |
54 | 54 |
55 | 55 #define next_filter (*ngx_http_top_body_filter) |
56 | |
57 #if 0 | |
56 static int (*next_filter) (ngx_http_request_t *r, ngx_chain_t *ch); | 58 static int (*next_filter) (ngx_http_request_t *r, ngx_chain_t *ch); |
59 #endif | |
57 | 60 |
58 | 61 |
59 #if 0 | 62 #if 0 |
60 #define next_filter ngx_http_output_filter_module_ctx.next_output_body_filter | 63 #define next_filter ngx_http_output_filter_module_ctx.next_output_body_filter |
61 #endif | 64 #endif |
75 ngx_http_output_filter_ctx_t *ctx; | 78 ngx_http_output_filter_ctx_t *ctx; |
76 ngx_http_output_filter_conf_t *conf; | 79 ngx_http_output_filter_conf_t *conf; |
77 | 80 |
78 ctx = (ngx_http_output_filter_ctx_t *) | 81 ctx = (ngx_http_output_filter_ctx_t *) |
79 ngx_http_get_module_ctx(r->main ? r->main : r, | 82 ngx_http_get_module_ctx(r->main ? r->main : r, |
80 ngx_http_output_filter_module); | 83 ngx_http_output_filter_module_ctx); |
81 | 84 |
82 if (ctx == NULL) { | 85 if (ctx == NULL) { |
83 ngx_http_create_ctx(r, ctx, ngx_http_output_filter_module, | 86 ngx_http_create_ctx(r, ctx, ngx_http_output_filter_module_ctx, |
84 sizeof(ngx_http_output_filter_ctx_t), NGX_ERROR); | 87 sizeof(ngx_http_output_filter_ctx_t), NGX_ERROR); |
85 } | 88 } |
86 | 89 |
87 /* the short path for the case when the chain ctx->incoming is empty | 90 /* the short path for the case when the chain ctx->incoming is empty |
88 and there is no hunk or the hunk does not require the copy */ | 91 and there is no hunk or the hunk does not require the copy */ |
118 | 121 |
119 /* allocate our hunk if it's needed */ | 122 /* allocate our hunk if it's needed */ |
120 if (ctx->hunk == NULL) { | 123 if (ctx->hunk == NULL) { |
121 | 124 |
122 conf = (ngx_http_output_filter_conf_t *) | 125 conf = (ngx_http_output_filter_conf_t *) |
123 ngx_http_get_module_loc_conf(r->main ? r->main : r, | 126 ngx_http_get_module_loc_conf(r->main ? r->main : r, |
124 ngx_http_output_filter_module); | 127 ngx_http_output_filter_module_ctx); |
125 | 128 |
126 if (hunk->type & NGX_HUNK_LAST) { | 129 if (hunk->type & NGX_HUNK_LAST) { |
127 if (hunk->type & NGX_HUNK_IN_MEMORY) { | 130 if (hunk->type & NGX_HUNK_IN_MEMORY) { |
128 size = hunk->last - hunk->pos; | 131 size = hunk->last - hunk->pos; |
129 } else { | 132 } else { |
301 | 304 |
302 | 305 |
303 static void ngx_http_output_filter_init(ngx_pool_t *pool, | 306 static void ngx_http_output_filter_init(ngx_pool_t *pool, |
304 ngx_http_conf_filter_t *cf) | 307 ngx_http_conf_filter_t *cf) |
305 { | 308 { |
309 #if 0 | |
306 next_filter = cf->output_body_filter; | 310 next_filter = cf->output_body_filter; |
307 cf->output_body_filter = NULL; | 311 cf->output_body_filter = NULL; |
312 #endif | |
308 } | 313 } |
309 | 314 |
310 | 315 |
311 static void *ngx_http_output_filter_create_conf(ngx_pool_t *pool) | 316 static void *ngx_http_output_filter_create_conf(ngx_pool_t *pool) |
312 { | 317 { |