diff options
author | Andrei Belov <defan@nginx.com> | 2021-02-04 18:40:45 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2021-02-04 18:40:45 +0300 |
commit | 0997fa324ca523ab282f595ac9f44b3e4daff86a (patch) | |
tree | 37424fff265780f34f9a9adb7ddd7501a67843f1 /src/nxt_http_static.c | |
parent | 2bc99c614d5547e773bda73364efada47f0a37bf (diff) | |
parent | 774a6034d9daf32ac6c98da7e4c0ca9e820536b4 (diff) | |
download | unit-0997fa324ca523ab282f595ac9f44b3e4daff86a.tar.gz unit-0997fa324ca523ab282f595ac9f44b3e4daff86a.tar.bz2 |
Merged with the default branch.
Diffstat (limited to 'src/nxt_http_static.c')
-rw-r--r-- | src/nxt_http_static.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/nxt_http_static.c b/src/nxt_http_static.c index 5687ef2c..df2655fc 100644 --- a/src/nxt_http_static.c +++ b/src/nxt_http_static.c @@ -395,12 +395,15 @@ static void nxt_http_static_buf_completion(nxt_task_t *task, void *obj, void *data) { ssize_t n, size; - nxt_buf_t *b, *fb; + nxt_buf_t *b, *fb, *next; nxt_off_t rest; nxt_http_request_t *r; b = obj; r = data; + +complete_buf: + fb = r->out; if (nxt_slow_path(fb == NULL || r->error)) { @@ -424,6 +427,8 @@ nxt_http_static_buf_completion(nxt_task_t *task, void *obj, void *data) goto clean; } + next = b->next; + if (n == rest) { nxt_file_close(task, fb->file); r->out = NULL; @@ -439,12 +444,24 @@ nxt_http_static_buf_completion(nxt_task_t *task, void *obj, void *data) b->mem.free = b->mem.pos + n; nxt_http_request_send(task, r, b); + + if (next != NULL) { + b = next; + goto complete_buf; + } + return; clean: - nxt_mp_free(r->mem_pool, b); - nxt_mp_release(r->mem_pool); + do { + next = b->next; + + nxt_mp_free(r->mem_pool, b); + nxt_mp_release(r->mem_pool); + + b = next; + } while (b != NULL); if (fb != NULL) { nxt_file_close(task, fb->file); |