Mercurial > hg > nginx
comparison src/http/ngx_http_output_filter.c @ 69:e43f406e4525
nginx-0.0.1-2003-03-20-19:09:44 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 20 Mar 2003 16:09:44 +0000 |
parents | 5a7d1aaa1618 |
children | 59229033ae93 |
comparison
equal
deleted
inserted
replaced
68:d549fdc17d7e | 69:e43f406e4525 |
---|---|
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, | 17 static char *ngx_http_output_filter_merge_conf(ngx_pool_t *pool, |
18 void *parent, void *child); | 18 void *parent, void *child); |
19 static void ngx_http_output_filter_init(ngx_pool_t *pool, | |
20 ngx_http_conf_filter_t *cf); | |
19 | 21 |
20 | 22 |
21 static ngx_command_t ngx_http_output_filter_commands[] = { | 23 static ngx_command_t ngx_http_output_filter_commands[] = { |
22 | 24 |
23 {ngx_string("output_buffer"), | 25 {ngx_string("output_buffer"), |
29 {ngx_null_string, 0, NULL, 0, 0} | 31 {ngx_null_string, 0, NULL, 0, 0} |
30 }; | 32 }; |
31 | 33 |
32 | 34 |
33 static ngx_http_module_t ngx_http_output_filter_module_ctx = { | 35 static ngx_http_module_t ngx_http_output_filter_module_ctx = { |
34 NGX_HTTP_MODULE, | |
35 | |
36 NULL, /* create server config */ | 36 NULL, /* create server config */ |
37 NULL, /* init server config */ | 37 NULL, /* init server config */ |
38 | |
38 ngx_http_output_filter_create_conf, /* create location config */ | 39 ngx_http_output_filter_create_conf, /* create location config */ |
39 ngx_http_output_filter_merge_conf, /* merge location config */ | 40 ngx_http_output_filter_merge_conf, /* merge location config */ |
40 | 41 |
41 NULL, /* translate handler */ | 42 ngx_http_output_filter_init /* output body filter */ |
42 | |
43 NULL, /* output header filter */ | |
44 NULL, /* next output header filter */ | |
45 (int (*)(ngx_http_request_t *, ngx_chain_t *)) | |
46 ngx_http_output_filter, /* output body filter */ | |
47 NULL /* next output body filter */ | |
48 }; | 43 }; |
49 | 44 |
50 | 45 |
51 ngx_module_t ngx_http_output_filter_module = { | 46 ngx_module_t ngx_http_output_filter_module = { |
52 0, /* module index */ | 47 0, /* module index */ |
56 NULL /* init module */ | 51 NULL /* init module */ |
57 }; | 52 }; |
58 | 53 |
59 | 54 |
60 | 55 |
56 static int (*next_filter) (ngx_http_request_t *r, ngx_chain_t *ch); | |
57 | |
58 | |
59 #if 0 | |
61 #define next_filter ngx_http_output_filter_module_ctx.next_output_body_filter | 60 #define next_filter ngx_http_output_filter_module_ctx.next_output_body_filter |
61 #endif | |
62 | 62 |
63 #define need_to_copy(r, hunk) \ | 63 #define need_to_copy(r, hunk) \ |
64 (((r->filter & NGX_HTTP_FILTER_NEED_IN_MEMORY) \ | 64 (((r->filter & NGX_HTTP_FILTER_NEED_IN_MEMORY) \ |
65 && (hunk->type & NGX_HUNK_FILE)) \ | 65 && (hunk->type & NGX_HUNK_FILE)) \ |
66 || ((r->filter & NGX_HTTP_FILTER_NEED_TEMP) \ | 66 || ((r->filter & NGX_HTTP_FILTER_NEED_TEMP) \ |
298 | 298 |
299 return NGX_OK; | 299 return NGX_OK; |
300 } | 300 } |
301 | 301 |
302 | 302 |
303 static void ngx_http_output_filter_init(ngx_pool_t *pool, | |
304 ngx_http_conf_filter_t *cf) | |
305 { | |
306 next_filter = cf->output_body_filter; | |
307 cf->output_body_filter = NULL; | |
308 } | |
309 | |
310 | |
303 static void *ngx_http_output_filter_create_conf(ngx_pool_t *pool) | 311 static void *ngx_http_output_filter_create_conf(ngx_pool_t *pool) |
304 { | 312 { |
305 ngx_http_output_filter_conf_t *conf; | 313 ngx_http_output_filter_conf_t *conf; |
306 | 314 |
307 ngx_test_null(conf, | 315 ngx_test_null(conf, |