Mercurial > hg > nginx-quic
comparison src/http/ngx_http_write_filter.c @ 96:a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 27 May 2003 12:18:54 +0000 |
parents | 637625a2acdb |
children | a059e1aa65d4 |
comparison
equal
deleted
inserted
replaced
95:b48066122884 | 96:a23d010f356d |
---|---|
26 ngx_conf_set_size_slot, | 26 ngx_conf_set_size_slot, |
27 NGX_HTTP_LOC_CONF_OFFSET, | 27 NGX_HTTP_LOC_CONF_OFFSET, |
28 offsetof(ngx_http_write_filter_conf_t, buffer_output), | 28 offsetof(ngx_http_write_filter_conf_t, buffer_output), |
29 NULL}, | 29 NULL}, |
30 | 30 |
31 {ngx_null_string, 0, NULL, 0, 0, NULL} | 31 ngx_null_command |
32 }; | 32 }; |
33 | 33 |
34 | 34 |
35 ngx_http_module_t ngx_http_write_filter_module_ctx = { | 35 ngx_http_module_t ngx_http_write_filter_module_ctx = { |
36 NGX_HTTP_MODULE, | |
37 | |
38 NULL, /* create main configuration */ | 36 NULL, /* create main configuration */ |
39 NULL, /* init main configuration */ | 37 NULL, /* init main configuration */ |
40 | 38 |
41 NULL, /* create server configuration */ | 39 NULL, /* create server configuration */ |
42 NULL, /* merge server configuration */ | 40 NULL, /* merge server configuration */ |
45 ngx_http_write_filter_merge_conf /* merge location configuration */ | 43 ngx_http_write_filter_merge_conf /* merge location configuration */ |
46 }; | 44 }; |
47 | 45 |
48 | 46 |
49 ngx_module_t ngx_http_write_filter_module = { | 47 ngx_module_t ngx_http_write_filter_module = { |
48 NGX_MODULE, | |
50 &ngx_http_write_filter_module_ctx, /* module context */ | 49 &ngx_http_write_filter_module_ctx, /* module context */ |
51 0, /* module index */ | |
52 ngx_http_write_filter_commands, /* module directives */ | 50 ngx_http_write_filter_commands, /* module directives */ |
53 NGX_HTTP_MODULE_TYPE, /* module type */ | 51 NGX_HTTP_MODULE, /* module type */ |
54 ngx_http_write_filter_init /* init module */ | 52 ngx_http_write_filter_init /* init module */ |
55 }; | 53 }; |
56 | 54 |
57 | 55 |
58 int ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in) | 56 int ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in) |
61 off_t size, flush; | 59 off_t size, flush; |
62 ngx_chain_t *ce, **le, *chain; | 60 ngx_chain_t *ce, **le, *chain; |
63 ngx_http_write_filter_ctx_t *ctx; | 61 ngx_http_write_filter_ctx_t *ctx; |
64 ngx_http_write_filter_conf_t *conf; | 62 ngx_http_write_filter_conf_t *conf; |
65 | 63 |
66 | |
67 ctx = ngx_http_get_module_ctx(r->main ? r->main : r, | 64 ctx = ngx_http_get_module_ctx(r->main ? r->main : r, |
68 ngx_http_write_filter_module_ctx); | 65 ngx_http_write_filter_module); |
69 | 66 |
70 if (ctx == NULL) { | 67 if (ctx == NULL) { |
71 ngx_http_create_ctx(r, ctx, ngx_http_write_filter_module_ctx, | 68 ngx_http_create_ctx(r, ctx, ngx_http_write_filter_module, |
72 sizeof(ngx_http_write_filter_ctx_t), NGX_ERROR); | 69 sizeof(ngx_http_write_filter_ctx_t), NGX_ERROR); |
73 } | 70 } |
74 | 71 |
75 size = flush = 0; | 72 size = flush = 0; |
76 last = 0; | 73 last = 0; |
120 last = 1; | 117 last = 1; |
121 } | 118 } |
122 } | 119 } |
123 | 120 |
124 conf = ngx_http_get_module_loc_conf(r->main ? r->main : r, | 121 conf = ngx_http_get_module_loc_conf(r->main ? r->main : r, |
125 ngx_http_write_filter_module_ctx); | 122 ngx_http_write_filter_module); |
126 | 123 |
127 #if (NGX_DEBUG_WRITE_FILTER) | 124 #if (NGX_DEBUG_WRITE_FILTER) |
128 ngx_log_debug(r->connection->log, | 125 ngx_log_debug(r->connection->log, |
129 "write filter: last:%d flush:%qd size:%qd" _ | 126 "write filter: last:%d flush:%qd size:%qd" _ |
130 last _ flush _ size); | 127 last _ flush _ size); |