-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix hanging requests with filtered steal (#3016)
* Integration test * Moved MetadataStore to a separate module * bind_similar -> BoundTcpSocket * BodyExt -> BatchedBody, reworked trait * local HTTP handling rework * Remove obsolete stuff from mirrord-protocol * Moved HttpResponseFallback to the agent * Moved frame senders to InterceptorHandle * HttpResponseReaders in IncomingProxy * Clippy * Better tracing * HttpResponseReader logic split into methods * unless_bus_closed * I hate this * HttpGateway tests * ClientStore test * Changed implementation of ClientStore shared state * Some docs * Docs * Removed obsolete integration test - replaced before with a unit test * More ClientStore tracing * Less spammy debug for InProxyTaskMessage * Clippy and docs * More tracing * Clippy * Fixed TcpProxyTask * More IncomingProxy docs * macos tests fixed * Fixed reverseportforwarder and its tests * Upgrade fixed * Extended changelog * Frames doc * Helper function for BatchedBody * auto_responder -> unwrap instead of is_err + break * ClientStore unwrap -> expect * Comments for ClientStore cleanup_task * Closed doc * TcpStealApi::response_body_tx doc * Removed expect from client_store::cleanup_task * Doc lint * Update mirrord/intproxy/src/background_tasks.rs Co-authored-by: meowjesty <[email protected]> * Update mirrord/intproxy/src/proxies/incoming.rs Co-authored-by: meowjesty <[email protected]> * error -> unreachable * pub(crate) for Closed * Update mirrord/intproxy/src/proxies/incoming.rs Co-authored-by: meowjesty <[email protected]> * not war * More doccc * self_address -> self * rephrased error messages * instrument on LocalHttpClient::new * More docs on clone for StreamingBody * docc * docsss * Doc fixed * Doc fixed * more instrument * in whole -> without a filter * moar doccc * TPC -> TCP * added ignore to doctest --------- Co-authored-by: meowjesty <[email protected]>
- Loading branch information
Showing
31 changed files
with
3,185 additions
and
2,695 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fixed an issue where HTTP requests stolen with a filter would hang with a single-threaded local HTTP server. | ||
Improved handling of incoming connections on the local machine (e.g introduces reuse of local HTTP connections). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use std::convert::Infallible; | ||
|
||
use bytes::Bytes; | ||
use http_body_util::{combinators::BoxBody, BodyExt, Full, StreamBody}; | ||
use hyper::{body::Frame, Response}; | ||
use mirrord_protocol::{ | ||
tcp::{HttpResponse, InternalHttpBody}, | ||
ConnectionId, RequestId, | ||
}; | ||
use tokio_stream::wrappers::ReceiverStream; | ||
|
||
pub type ReceiverStreamBody = StreamBody<ReceiverStream<Result<Frame<Bytes>, Infallible>>>; | ||
|
||
#[derive(Debug)] | ||
pub enum HttpResponseFallback { | ||
Framed(HttpResponse<InternalHttpBody>), | ||
Fallback(HttpResponse<Vec<u8>>), | ||
Streamed(HttpResponse<ReceiverStreamBody>), | ||
} | ||
|
||
impl HttpResponseFallback { | ||
pub fn connection_id(&self) -> ConnectionId { | ||
match self { | ||
HttpResponseFallback::Framed(req) => req.connection_id, | ||
HttpResponseFallback::Fallback(req) => req.connection_id, | ||
HttpResponseFallback::Streamed(req) => req.connection_id, | ||
} | ||
} | ||
|
||
pub fn request_id(&self) -> RequestId { | ||
match self { | ||
HttpResponseFallback::Framed(req) => req.request_id, | ||
HttpResponseFallback::Fallback(req) => req.request_id, | ||
HttpResponseFallback::Streamed(req) => req.request_id, | ||
} | ||
} | ||
|
||
pub fn into_hyper<E>(self) -> Response<BoxBody<Bytes, E>> { | ||
match self { | ||
HttpResponseFallback::Framed(req) => req | ||
.internal_response | ||
.map_body(|body| body.map_err(|_| unreachable!()).boxed()) | ||
.into(), | ||
HttpResponseFallback::Fallback(req) => req | ||
.internal_response | ||
.map_body(|body| { | ||
Full::new(Bytes::from_owner(body)) | ||
.map_err(|_| unreachable!()) | ||
.boxed() | ||
}) | ||
.into(), | ||
HttpResponseFallback::Streamed(req) => req | ||
.internal_response | ||
.map_body(|body| body.map_err(|_| unreachable!()).boxed()) | ||
.into(), | ||
} | ||
} | ||
} |
Oops, something went wrong.