comparison src/http/ngx_http_write_filter.c @ 91:637625a2acdb

nginx-0.0.1-2003-05-19-20:39:14 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 19 May 2003 16:39:14 +0000
parents 37530da31268
children a23d010f356d
comparison
equal deleted inserted replaced
90:37530da31268 91:637625a2acdb
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, 36 NGX_HTTP_MODULE,
37 37
38 NULL, /* create server config */ 38 NULL, /* create main configuration */
39 NULL, /* init server config */ 39 NULL, /* init main configuration */
40 40
41 ngx_http_write_filter_create_conf, /* create location config */ 41 NULL, /* create server configuration */
42 ngx_http_write_filter_merge_conf /* merge location config */ 42 NULL, /* merge server configuration */
43
44 ngx_http_write_filter_create_conf, /* create location configuration */
45 ngx_http_write_filter_merge_conf /* merge location configuration */
43 }; 46 };
44 47
45 48
46 ngx_module_t ngx_http_write_filter_module = { 49 ngx_module_t ngx_http_write_filter_module = {
47 &ngx_http_write_filter_module_ctx, /* module context */ 50 &ngx_http_write_filter_module_ctx, /* module context */
59 ngx_chain_t *ce, **le, *chain; 62 ngx_chain_t *ce, **le, *chain;
60 ngx_http_write_filter_ctx_t *ctx; 63 ngx_http_write_filter_ctx_t *ctx;
61 ngx_http_write_filter_conf_t *conf; 64 ngx_http_write_filter_conf_t *conf;
62 65
63 66
64 ctx = (ngx_http_write_filter_ctx_t *) 67 ctx = ngx_http_get_module_ctx(r->main ? r->main : r,
65 ngx_http_get_module_ctx(r->main ? r->main : r, 68 ngx_http_write_filter_module_ctx);
66 ngx_http_write_filter_module_ctx); 69
67 if (ctx == NULL) { 70 if (ctx == NULL) {
68 ngx_http_create_ctx(r, ctx, ngx_http_write_filter_module_ctx, 71 ngx_http_create_ctx(r, ctx, ngx_http_write_filter_module_ctx,
69 sizeof(ngx_http_write_filter_ctx_t), NGX_ERROR); 72 sizeof(ngx_http_write_filter_ctx_t), NGX_ERROR);
70 } 73 }
71 74
116 if (ce->hunk->type & NGX_HUNK_LAST) { 119 if (ce->hunk->type & NGX_HUNK_LAST) {
117 last = 1; 120 last = 1;
118 } 121 }
119 } 122 }
120 123
121 conf = (ngx_http_write_filter_conf_t *) 124 conf = ngx_http_get_module_loc_conf(r->main ? r->main : r,
122 ngx_http_get_module_loc_conf(r->main ? r->main : r, 125 ngx_http_write_filter_module_ctx);
123 ngx_http_write_filter_module_ctx);
124 126
125 #if (NGX_DEBUG_WRITE_FILTER) 127 #if (NGX_DEBUG_WRITE_FILTER)
126 ngx_log_debug(r->connection->log, 128 ngx_log_debug(r->connection->log,
127 "write filter: last:%d flush:%qd size:%qd" _ 129 "write filter: last:%d flush:%qd size:%qd" _
128 last _ flush _ size); 130 last _ flush _ size);
137 139
138 if (r->connection->write->delayed) { 140 if (r->connection->write->delayed) {
139 return NGX_AGAIN; 141 return NGX_AGAIN;
140 } 142 }
141 143
144 #if 1
145 chain = ngx_write_chain(r->connection, ctx->out);
146 #else
142 chain = ngx_write_chain(r->connection, ctx->out, flush); 147 chain = ngx_write_chain(r->connection, ctx->out, flush);
148 #endif
143 149
144 #if (NGX_DEBUG_WRITE_FILTER) 150 #if (NGX_DEBUG_WRITE_FILTER)
145 ngx_log_debug(r->connection->log, "write filter %x" _ chain); 151 ngx_log_debug(r->connection->log, "write filter %x" _ chain);
146 #endif 152 #endif
147 153
175 181
176 182
177 static char *ngx_http_write_filter_merge_conf(ngx_pool_t *pool, 183 static char *ngx_http_write_filter_merge_conf(ngx_pool_t *pool,
178 void *parent, void *child) 184 void *parent, void *child)
179 { 185 {
180 ngx_http_write_filter_conf_t *prev = 186 ngx_http_write_filter_conf_t *prev = parent;
181 (ngx_http_write_filter_conf_t *) parent; 187 ngx_http_write_filter_conf_t *conf = child;
182 ngx_http_write_filter_conf_t *conf = 188
183 (ngx_http_write_filter_conf_t *) child; 189 ngx_conf_merge_size_value(conf->buffer_output, prev->buffer_output, 1460);
184
185 ngx_conf_size_merge(conf->buffer_output, prev->buffer_output, 1460);
186 190
187 return NULL; 191 return NULL;
188 } 192 }
189 193
190 194