Latest update - 7508

This commit is contained in:
2019-05-14 08:44:24 +09:00
parent b0003469d0
commit 83915a055e
3 changed files with 49 additions and 29 deletions
+47 -11
View File
@@ -700,8 +700,9 @@ ngx_http_range_singlepart_body(ngx_http_request_t *r,
ngx_http_range_filter_ctx_t *ctx, ngx_chain_t *in)
{
off_t start, last;
ngx_int_t rc;
ngx_buf_t *buf;
ngx_chain_t *out, *cl, **ll;
ngx_chain_t *out, *cl, *tl, **ll;
ngx_http_range_t *range;
out = NULL;
@@ -721,8 +722,22 @@ ngx_http_range_singlepart_body(ngx_http_request_t *r,
"http range body buf: %O-%O", start, last);
if (ngx_buf_special(buf)) {
*ll = cl;
ll = &cl->next;
if (range->end <= start) {
continue;
}
tl = ngx_alloc_chain_link(r->pool);
if (tl == NULL) {
return NGX_ERROR;
}
tl->buf = buf;
tl->next = NULL;
*ll = tl;
ll = &tl->next;
continue;
}
@@ -764,21 +779,42 @@ ngx_http_range_singlepart_body(ngx_http_request_t *r,
buf->last_buf = (r == r->main) ? 1 : 0;
buf->last_in_chain = 1;
*ll = cl;
cl->next = NULL;
break;
tl = ngx_alloc_chain_link(r->pool);
if (tl == NULL) {
return NGX_ERROR;
}
tl->buf = buf;
tl->next = NULL;
*ll = tl;
ll = &tl->next;
continue;
}
*ll = cl;
ll = &cl->next;
tl = ngx_alloc_chain_link(r->pool);
if (tl == NULL) {
return NGX_ERROR;
}
tl->buf = buf;
tl->next = NULL;
*ll = tl;
ll = &tl->next;
}
if (out == NULL) {
return NGX_OK;
rc = ngx_http_next_body_filter(r, out);
while (out) {
cl = out;
out = out->next;
ngx_free_chain(r->pool, cl);
}
return ngx_http_next_body_filter(r, out);
return rc;
}