aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.bleep2
-rw-r--r--pingora-core/src/protocols/http/v2/server.rs8
-rw-r--r--pingora-proxy/src/proxy_h1.rs4
3 files changed, 9 insertions, 5 deletions
diff --git a/.bleep b/.bleep
index c867e31..f999f12 100644
--- a/.bleep
+++ b/.bleep
@@ -1 +1 @@
-ce25a5ec3f6937d70f6a60b79adb6dd299144a84 \ No newline at end of file
+32635fba2c86e17defba5601199d11373dce0bea \ No newline at end of file
diff --git a/pingora-core/src/protocols/http/v2/server.rs b/pingora-core/src/protocols/http/v2/server.rs
index 6d6b393..718ddde 100644
--- a/pingora-core/src/protocols/http/v2/server.rs
+++ b/pingora-core/src/protocols/http/v2/server.rs
@@ -387,13 +387,15 @@ impl HttpSession {
/// Whether there is no more body to read
pub fn is_body_done(&self) -> bool {
- self.request_body_reader.is_end_stream()
+ // Check no body in request
+ // Also check we hit end of stream
+ self.is_body_empty() || self.request_body_reader.is_end_stream()
}
- /// Whether there is any body to read.
+ /// Whether there is any body to read. true means there no body in request.
pub fn is_body_empty(&self) -> bool {
self.body_read == 0
- && (self.is_body_done()
+ && (self.request_body_reader.is_end_stream()
|| self
.request_header
.headers
diff --git a/pingora-proxy/src/proxy_h1.rs b/pingora-proxy/src/proxy_h1.rs
index 544a74e..e13d4c1 100644
--- a/pingora-proxy/src/proxy_h1.rs
+++ b/pingora-proxy/src/proxy_h1.rs
@@ -311,7 +311,9 @@ impl<SV> HttpProxy<SV> {
},
_ = tx.reserve(), if downstream_state.is_reading() && send_permit.is_err() => {
- debug!("waiting for permit {send_permit:?}");
+ // If tx is closed, downstream already finish its job.
+ downstream_state.maybe_finished(tx.is_closed());
+ debug!("waiting for permit {send_permit:?}, downstream closed {}", tx.is_closed());
/* No permit, wait on more capacity to avoid starving.
* Otherwise this select only blocks on rx, which might send no data
* before the entire body is uploaded.