Skip to content

Commit 9c69508

Browse files
author
Felipe Zimmerle
committed
nginx refactoring
Refactoring on the nginx module, including: - Better handling larger posts; - Now using nginx echo module during the regression tests. - Better interacting with neginx chain rules - Separation of the request handling and content filters. - Better handling nginx sessions and resource counts to allow a more efficient garbage collector. - Handling both http/1.0 and 1.1, including keep-alive. - Tests are now capable to test nginx as a proxy or end-server. - Tested agains nginx 1.6 and 1.7.
1 parent 06e430e commit 9c69508

File tree

5 files changed

+349
-227
lines changed

5 files changed

+349
-227
lines changed

nginx/modsecurity/apr_bucket_nginx.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ ngx_buf_t * apr_bucket_to_ngx_buf(apr_bucket *e, ngx_pool_t *pool) {
154154
}
155155

156156
ngx_int_t
157-
move_chain_to_brigade(ngx_chain_t *chain, apr_bucket_brigade *bb, ngx_pool_t *pool, ngx_int_t last_buf) {
157+
move_chain_to_brigade(ngx_chain_t *chain_orig, apr_bucket_brigade *bb, ngx_pool_t *pool, ngx_int_t last_buf) {
158158
apr_bucket *e;
159-
ngx_chain_t *cl;
159+
ngx_chain_t *cl;
160+
161+
ngx_chain_t *chain = chain_orig;
160162

161163
while (chain) {
162164
e = ngx_buf_to_apr_bucket(chain->buf, bb->p, bb->bucket_alloc);
@@ -168,7 +170,6 @@ move_chain_to_brigade(ngx_chain_t *chain, apr_bucket_brigade *bb, ngx_pool_t *po
168170
if (chain->buf->last_buf) {
169171
e = apr_bucket_eos_create(bb->bucket_alloc);
170172
APR_BRIGADE_INSERT_TAIL(bb, e);
171-
chain->buf->last_buf = 0;
172173
return NGX_OK;
173174
}
174175
cl = chain;
@@ -181,7 +182,6 @@ move_chain_to_brigade(ngx_chain_t *chain, apr_bucket_brigade *bb, ngx_pool_t *po
181182
APR_BRIGADE_INSERT_TAIL(bb, e);
182183
return NGX_OK;
183184
}
184-
185185
return NGX_AGAIN;
186186
}
187187

@@ -215,8 +215,10 @@ move_brigade_to_chain(apr_bucket_brigade *bb, ngx_chain_t **ll, ngx_pool_t *pool
215215
}
216216

217217
cl->buf->last_buf = 1;
218+
cl->next = NULL;
218219
*ll = cl;
219220
} else {
221+
cl->next = NULL;
220222
cl->buf->last_buf = 1;
221223
}
222224
apr_brigade_cleanup(bb);
@@ -243,6 +245,7 @@ move_brigade_to_chain(apr_bucket_brigade *bb, ngx_chain_t **ll, ngx_pool_t *pool
243245
ll = &cl->next;
244246
}
245247

248+
246249
apr_brigade_cleanup(bb);
247250
/* no eos or error */
248251
return NGX_ERROR;

0 commit comments

Comments
 (0)