Handle client-disabled server push (#486)
This commit is contained in:
@@ -32,6 +32,8 @@ pub(super) struct Send {
|
||||
|
||||
/// Prioritization layer
|
||||
prioritize: Prioritize,
|
||||
|
||||
is_push_enabled: bool,
|
||||
}
|
||||
|
||||
/// A value to detect which public API has called `poll_reset`.
|
||||
@@ -49,6 +51,7 @@ impl Send {
|
||||
max_stream_id: StreamId::MAX,
|
||||
next_stream_id: Ok(config.local_next_stream_id),
|
||||
prioritize: Prioritize::new(config),
|
||||
is_push_enabled: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +98,10 @@ impl Send {
|
||||
stream: &mut store::Ptr,
|
||||
task: &mut Option<Waker>,
|
||||
) -> Result<(), UserError> {
|
||||
if !self.is_push_enabled {
|
||||
return Err(UserError::PeerDisabledServerPush);
|
||||
}
|
||||
|
||||
tracing::trace!(
|
||||
"send_push_promise; frame={:?}; init_window={:?}",
|
||||
frame,
|
||||
@@ -496,6 +503,10 @@ impl Send {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(val) = settings.is_push_enabled() {
|
||||
self.is_push_enabled = val
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user