|
|
@@ -276,15 +276,12 @@ ngx_http_uploadprogress_content_handler(ngx_http_request_t *r)
|
|
276
|
276
|
return rc;
|
|
277
|
277
|
}
|
|
278
|
278
|
|
|
279
|
|
- /* request is OK, hijack the read_event_handler */
|
|
280
|
|
- ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_uploadprogress_module_ctx_t));
|
|
281
|
|
- if (ctx == NULL) {
|
|
282
|
|
- return NGX_ERROR;
|
|
|
279
|
+ /* request is OK, hijack the read_event_handler if the request has to be tracked*/
|
|
|
280
|
+ ctx = ngx_http_get_module_ctx(r, ngx_http_uploadprogress_module);
|
|
|
281
|
+ if (ctx != NULL) {
|
|
|
282
|
+ ctx->read_event_handler = r->read_event_handler;
|
|
|
283
|
+ r->read_event_handler = ngx_http_uploadprogress_event_handler;
|
|
283
|
284
|
}
|
|
284
|
|
-
|
|
285
|
|
- ctx->read_event_handler = r->read_event_handler;
|
|
286
|
|
- ngx_http_set_ctx(r, ctx, ngx_http_uploadprogress_module);
|
|
287
|
|
- r->read_event_handler = ngx_http_uploadprogress_event_handler;
|
|
288
|
285
|
return rc;
|
|
289
|
286
|
}
|
|
290
|
287
|
|
|
|
@@ -679,6 +676,13 @@ ngx_http_uploadprogress_handler(ngx_http_request_t * r)
|
|
679
|
676
|
upcln->timeout = upcf->timeout;
|
|
680
|
677
|
upcln->r = r;
|
|
681
|
678
|
|
|
|
679
|
+ ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_uploadprogress_module_ctx_t));
|
|
|
680
|
+ if (ctx == NULL) {
|
|
|
681
|
+ return NGX_ERROR;
|
|
|
682
|
+ }
|
|
|
683
|
+
|
|
|
684
|
+ ngx_http_set_ctx(r, ctx, ngx_http_uploadprogress_module);
|
|
|
685
|
+
|
|
682
|
686
|
/* finally says to the core we don't handle anything */
|
|
683
|
687
|
return NGX_DECLINED;
|
|
684
|
688
|
}
|