comparison src/http/ngx_http_copy_filter_module.c @ 3053:0d253659da12

directio_alignment
author Igor Sysoev <igor@sysoev.ru>
date Fri, 28 Aug 2009 08:15:55 +0000
parents 6060225e9261
children aa720192937b
comparison
equal deleted inserted replaced
3052:6060225e9261 3053:0d253659da12
92 "copy filter: \"%V?%V\"", &r->uri, &r->args); 92 "copy filter: \"%V?%V\"", &r->uri, &r->args);
93 93
94 ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module); 94 ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module);
95 95
96 if (ctx == NULL) { 96 if (ctx == NULL) {
97 conf = ngx_http_get_module_loc_conf(r, ngx_http_copy_filter_module);
98
99 ctx = ngx_pcalloc(r->pool, sizeof(ngx_output_chain_ctx_t)); 97 ctx = ngx_pcalloc(r->pool, sizeof(ngx_output_chain_ctx_t));
100 if (ctx == NULL) { 98 if (ctx == NULL) {
101 return NGX_ERROR; 99 return NGX_ERROR;
102 } 100 }
103 101
104 ngx_http_set_ctx(r, ctx, ngx_http_copy_filter_module); 102 ngx_http_set_ctx(r, ctx, ngx_http_copy_filter_module);
105 103
104 conf = ngx_http_get_module_loc_conf(r, ngx_http_copy_filter_module);
105 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
106
106 ctx->sendfile = c->sendfile; 107 ctx->sendfile = c->sendfile;
107 ctx->need_in_memory = r->main_filter_need_in_memory 108 ctx->need_in_memory = r->main_filter_need_in_memory
108 || r->filter_need_in_memory; 109 || r->filter_need_in_memory;
109 ctx->need_in_temp = r->filter_need_temporary; 110 ctx->need_in_temp = r->filter_need_temporary;
110 111
112 ctx->alignment = clcf->directio_alignment;
113
111 ctx->pool = r->pool; 114 ctx->pool = r->pool;
112 ctx->bufs = conf->bufs; 115 ctx->bufs = conf->bufs;
113 ctx->tag = (ngx_buf_tag_t) &ngx_http_copy_filter_module; 116 ctx->tag = (ngx_buf_tag_t) &ngx_http_copy_filter_module;
114 117
115 ctx->output_filter = (ngx_output_chain_filter_pt) ngx_http_next_filter; 118 ctx->output_filter = (ngx_output_chain_filter_pt) ngx_http_next_filter;
116 ctx->filter_ctx = r; 119 ctx->filter_ctx = r;
117 120
118 #if (NGX_HAVE_FILE_AIO) 121 #if (NGX_HAVE_FILE_AIO)
119 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
120 if (clcf->aio) { 122 if (clcf->aio) {
121 ctx->aio = ngx_http_copy_aio_handler; 123 ctx->aio = ngx_http_copy_aio_handler;
122 } 124 }
123 #endif 125 #endif
124 126