Quellcode durchsuchen

Properly track progress of smaller file uploads

tags/v0.9.1
wbond vor 12 Jahren
Ursprung
Commit
aa4e8b9355
1 geänderte Dateien mit 9 neuen und 0 gelöschten Zeilen
  1. 9
    0
      ngx_http_uploadprogress_module.c

+ 9
- 0
ngx_http_uploadprogress_module.c Datei anzeigen

@@ -833,6 +833,15 @@ ngx_http_uploadprogress_handler(ngx_http_request_t * r)
833 833
     up->length = 0;
834 834
     up->timeout = 0;
835 835
 
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
+
836 845
     up->next = ctx->list_head.next;
837 846
     up->next->prev = up;
838 847
     up->prev = &ctx->list_head;

Laden…
Abbrechen
Speichern