Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::body::channel_body::FrameBridge;
use crate::event_error::EventKind;
use crate::listeners::http_connection_manager::ext_proc::kind;
use crate::listeners::http_connection_manager::ext_proc::mutation::apply_trailer_mutations;
use crate::listeners::http_connection_manager::ext_proc::r#override::OverridableBodyMode;
use crate::listeners::http_connection_manager::ext_proc::r#override::{
OverridableGlobalModes, OverridableModeSelector,
};
Expand Down Expand Up @@ -49,6 +50,10 @@ use tracing::{debug, warn};

pub struct RequestProcessing<M: kind::Mode>(Processing<M, kind::RequestMsg>);

fn is_streamed_body_mode(mode: &OverridableBodyMode) -> bool {
matches!(mode, OverridableBodyMode::Streamed)
}

impl<M: kind::Mode> Deref for RequestProcessing<M> {
type Target = Processing<M, kind::RequestMsg>;
fn deref(&self) -> &Self::Target {
Expand Down Expand Up @@ -539,7 +544,11 @@ impl<M: kind::Mode + Default, Msg: kind::MsgKind + OverridableModeSelector> Proc
let send_body_or_trailers =
override_mode.should_process_body::<Msg>() || override_mode.should_process_trailers::<Msg>();

if M::OBSERVABILITY || (self.send_body_without_waiting_for_header_response && send_body_or_trailers) {
if M::OBSERVABILITY
|| (self.send_body_without_waiting_for_header_response
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am still not sure if this is going to work as expected,
my understanding is streaming_body_enabled should be true unless self.send_body_without_waiting_for_header_response is false and OverridableBodyMode::Streamed
in every other case we assume that we will send the body without waiting for the response

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dawid-nowak, thanks for the clarification — that makes sense.

You’re right, according to the Envoy documentation the
send_body_without_waiting_for_header_response flag is only meaningful
for STREAMED mode and ignored for other body modes.

Based on your comment, the correct behavior should be:

  • streaming_body_enabled defaults to true
  • except when:
    • body_mode == OverridableBodyMode::Streamed
    • AND send_body_without_waiting_for_header_response == false
      In that specific case we should wait for the header response before
      sending body frames.

I’ll update the logic accordingly and adjust the condition so that
non-streamed modes always send the body early, matching Envoy semantics.

Thanks for pointing this out — I’ll push an updated commit shortly.

&& send_body_or_trailers
&& !is_streamed_body_mode(&override_mode.body_mode::<Msg>()))
{
self.streaming_body_enabled = true;
}

Expand Down