From be6dcdb7fc4ec160ad4d79329dc2eb561f909e72 Mon Sep 17 00:00:00 2001 From: spacewander Date: Thu, 26 Sep 2024 13:16:01 +0000 Subject: document request_body_filter Includes-commit: cd6f77726b2a5ca57f885af360de2ad0de788e87 Replicated-from: https://github.com/cloudflare/pingora/pull/402 Signed-off-by: spacewander --- .bleep | 2 +- docs/user_guide/phase.md | 6 +++++- docs/user_guide/phase_chart.md | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.bleep b/.bleep index da57c1f..d9ff5c9 100644 --- a/.bleep +++ b/.bleep @@ -1 +1 @@ -8e05a8f5b9d09885e6374011c422678043a2bda0 \ No newline at end of file +9ec41e3e1817e36107195f6ca1a3168779857cc7 \ No newline at end of file diff --git a/docs/user_guide/phase.md b/docs/user_guide/phase.md index 46e9b5d..4e520c7 100644 --- a/docs/user_guide/phase.md +++ b/docs/user_guide/phase.md @@ -26,7 +26,8 @@ Pingora-proxy allows users to insert arbitrary logic into the life of a request. Connect--connection failure-->fail_to_connect; connected_to_upstream-->upstream_request_filter; - upstream_request_filter --> SendReq{{IO: send request to upstream}}; + upstream_request_filter --> request_body_filter; + request_body_filter --> SendReq{{IO: send request to upstream}}; SendReq-->RecvResp{{IO: read response from upstream}}; RecvResp-->upstream_response_filter-->response_filter-->upstream_response_body_filter-->response_body_filter-->logging-->endreq("request done"); @@ -61,6 +62,9 @@ This function is similar to `request_filter()` but executes before any other log ### `request_filter()` This phase is usually for validating request inputs, rate limiting, and initializing context. +### `request_body_filter()` +This phase is triggered after a response body is ready to send to upstream. It will be called every time a piece of request body is received. + ### `proxy_upstream_filter()` This phase determines if we should continue to the upstream to serve a response. If we short-circuit, a 502 is returned by default, but a different response can be implemented. diff --git a/docs/user_guide/phase_chart.md b/docs/user_guide/phase_chart.md index a6b6a4e..9498872 100644 --- a/docs/user_guide/phase_chart.md +++ b/docs/user_guide/phase_chart.md @@ -11,7 +11,8 @@ Pingora proxy phases without caching Connect--connection failure-->fail_to_connect; connected_to_upstream-->upstream_request_filter; - upstream_request_filter --> SendReq{{IO: send request to upstream}}; + upstream_request_filter --> request_body_filter; + request_body_filter --> SendReq{{IO: send request to upstream}}; SendReq-->RecvResp{{IO: read response from upstream}}; RecvResp-->upstream_response_filter-->response_filter-->upstream_response_body_filter-->response_body_filter-->logging-->endreq("request done"); -- cgit v1.2.3