Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove empty buffers

  • Loading branch information...
commit e9792dc879751d73a8c6eab570c2171cf26756c2 1 parent 7457c21
Evan Miller authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 ngx_http_strip_filter_module.c
View
14 ngx_http_strip_filter_module.c
@@ -168,7 +168,7 @@ static ngx_int_t
ngx_http_strip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
{
ngx_http_strip_ctx_t *ctx;
- ngx_chain_t *chain_link;
+ ngx_chain_t *chain_link, *prev_link = NULL;
ctx = ngx_http_get_module_ctx(r, ngx_http_strip_filter_module);
if (ctx == NULL) {
@@ -177,8 +177,20 @@ ngx_http_strip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
for (chain_link = in; chain_link; chain_link = chain_link->next) {
ngx_http_strip_process_buffer(chain_link->buf, ctx);
+ if (chain_link->buf->pos == chain_link->buf->last) {
+ if (prev_link) {
+ prev_link->next = chain_link->next;
+ } else {
+ in = chain_link->next;
+ }
+ } else {
+ prev_link = chain_link;
+ }
}
+ if (in == NULL)
+ return NGX_OK;
+
return ngx_http_next_body_filter(r, in);
}
Please sign in to comment.
Something went wrong with that request. Please try again.