File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
pingora-core/src/protocols/http/v2 Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1- ce25a5ec3f6937d70f6a60b79adb6dd299144a84
1+ 32635fba2c86e17defba5601199d11373dce0bea
Original file line number Diff line number Diff line change @@ -387,13 +387,15 @@ impl HttpSession {
387387
388388 /// Whether there is no more body to read
389389 pub fn is_body_done ( & self ) -> bool {
390- self . request_body_reader . is_end_stream ( )
390+ // Check no body in request
391+ // Also check we hit end of stream
392+ self . is_body_empty ( ) || self . request_body_reader . is_end_stream ( )
391393 }
392394
393- /// Whether there is any body to read.
395+ /// Whether there is any body to read. true means there no body in request.
394396 pub fn is_body_empty ( & self ) -> bool {
395397 self . body_read == 0
396- && ( self . is_body_done ( )
398+ && ( self . request_body_reader . is_end_stream ( )
397399 || self
398400 . request_header
399401 . headers
Original file line number Diff line number Diff line change @@ -311,7 +311,9 @@ impl<SV> HttpProxy<SV> {
311311 } ,
312312
313313 _ = tx. reserve( ) , if downstream_state. is_reading( ) && send_permit. is_err( ) => {
314- debug!( "waiting for permit {send_permit:?}" ) ;
314+ // If tx is closed, downstream already finish its job.
315+ downstream_state. maybe_finished( tx. is_closed( ) ) ;
316+ debug!( "waiting for permit {send_permit:?}, downstream closed {}" , tx. is_closed( ) ) ;
315317 /* No permit, wait on more capacity to avoid starving.
316318 * Otherwise this select only blocks on rx, which might send no data
317319 * before the entire body is uploaded.
You can’t perform that action at this time.
0 commit comments