Skip to content

Commit aa4e8b9

Browse files
committed
Properly track progress of smaller file uploads
1 parent a788dea commit aa4e8b9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ngx_http_uploadprogress_module.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,15 @@ ngx_http_uploadprogress_handler(ngx_http_request_t * r)
833833
up->length = 0;
834834
up->timeout = 0;
835835

836+
// Properly handles small files where no read events happen after the
837+
// request is first handled
838+
if (r->headers_in.content_length_n) {
839+
up->length = r->headers_in.content_length_n;
840+
if (r->request_body) {
841+
up->rest = r->request_body->rest;
842+
}
843+
}
844+
836845
up->next = ctx->list_head.next;
837846
up->next->prev = up;
838847
up->prev = &ctx->list_head;

0 commit comments

Comments
 (0)