mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-19 17:16:43 +02:00
44 lines
1.9 KiB
Diff
44 lines
1.9 KiB
Diff
Patch-Source: https://github.com/masterzen/nginx-upload-progress-module/pull/57
|
|
--
|
|
From 594f1233c3c622ad51a2bde0c3289747af20e245 Mon Sep 17 00:00:00 2001
|
|
From: Allan Jude <allanjude@freebsd.org>
|
|
Date: Sat, 26 Nov 2022 20:28:10 +0000
|
|
Subject: [PATCH] Restore functionality of upload-progress for HTTP2
|
|
|
|
The upload-progress module was only getting notified of the first
|
|
block of uploaded data, because r->read_event_handler was being
|
|
reset by ngx_http_v2_read_request_body() and
|
|
ngx_http_v2_process_request_body()
|
|
|
|
The patch detects that situation, updates module_ctx to call the
|
|
new function, then reinserts itself as the read_event_handler so
|
|
we continue to be notified about uploaded data.
|
|
|
|
Introduced in nginx/nginx@67d160bf25e02ba6679bb6c3b9cbdfeb29b759de
|
|
|
|
Sponsored-by: ScaleEngine Inc.
|
|
---
|
|
ngx_http_uploadprogress_module.c | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/ngx_http_uploadprogress_module.c b/ngx_http_uploadprogress_module.c
|
|
index 33bdaf7..f17ad92 100644
|
|
--- a/ngx_http_uploadprogress_module.c
|
|
+++ b/ngx_http_uploadprogress_module.c
|
|
@@ -489,6 +489,16 @@ static void ngx_http_uploadprogress_event_handler(ngx_http_request_t *r)
|
|
module_ctx = ngx_http_get_module_ctx(r, ngx_http_uploadprogress_module);
|
|
if (module_ctx != NULL ) {
|
|
module_ctx->read_event_handler(r);
|
|
+ /*
|
|
+ * Both ngx_http_v2_read_request_body() and
|
|
+ * ngx_http_v2_process_request_body() modify read_event_handler,
|
|
+ * we respect the change, but re-interpose our function so we still get
|
|
+ * future events, otherwise we miss all upload progress.
|
|
+ */
|
|
+ if (r->read_event_handler != ngx_http_uploadprogress_event_handler) {
|
|
+ module_ctx->read_event_handler = r->read_event_handler;
|
|
+ r->read_event_handler = ngx_http_uploadprogress_event_handler;
|
|
+ }
|
|
}
|
|
|
|
/* at this stage, r is not anymore safe to use */
|