1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

Move tower-http dep to the workspace and adapt mas-axum-utils

We removed here the Timeout layer on the HTTP client service, because it
required the body to be Default, which isn't the case anymore. Not sure
what to do about it.
This commit is contained in:
Quentin Gliech
2024-07-02 10:38:05 +02:00
parent f338aacf26
commit e7f50a92d6
13 changed files with 56 additions and 68 deletions

View File

@@ -25,12 +25,13 @@ opentelemetry.workspace = true
opentelemetry-semantic-conventions.workspace = true
rustls = { workspace = true, optional = true }
rustls-platform-verifier = { workspace = true, optional = true }
pin-project-lite = "0.2.14"
serde.workspace = true
serde_json.workspace = true
serde_urlencoded = "0.7.1"
thiserror.workspace = true
tower.workspace = true
tower-http = { version = "0.5.2", features = ["cors"] }
tower-http.workspace = true
tracing.workspace = true
tracing-opentelemetry.workspace = true

View File

@@ -1,4 +1,4 @@
// Copyright 2022 The Matrix.org Foundation C.I.C.
// Copyright 2022-2024 The Matrix.org Foundation C.I.C.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::time::Duration;
use headers::{ContentLength, HeaderMapExt, Host, UserAgent};
use http::{header::USER_AGENT, HeaderValue, Request, Response};
use hyper_util::client::legacy::connect::HttpInfo;
@@ -35,7 +33,6 @@ use tower::{
use tower_http::{
follow_redirect::{FollowRedirect, FollowRedirectLayer},
set_header::{SetRequestHeader, SetRequestHeaderLayer},
timeout::{Timeout, TimeoutLayer},
};
use tracing::Span;
@@ -45,7 +42,7 @@ pub type ClientService<S> = SetRequestHeader<
ConcurrencyLimit<
FollowRedirect<
TraceService<
TraceContextService<Timeout<S>>,
TraceContextService<S>,
MakeSpanForRequest,
EnrichSpanOnResponse,
EnrichSpanOnError,
@@ -183,7 +180,6 @@ pub struct ClientLayer {
follow_redirect_layer: FollowRedirectLayer,
trace_layer: TraceLayer<MakeSpanForRequest, EnrichSpanOnResponse, EnrichSpanOnError>,
trace_context_layer: TraceContextLayer,
timeout_layer: TimeoutLayer,
duration_recorder_layer: DurationRecorderLayer<OnRequestLabels, OnResponseLabels, KeyValue>,
in_flight_counter_layer: InFlightCounterLayer<OnRequestLabels>,
}
@@ -208,7 +204,6 @@ impl ClientLayer {
.on_response(EnrichSpanOnResponse)
.on_error(EnrichSpanOnError),
trace_context_layer: TraceContextLayer::new(),
timeout_layer: TimeoutLayer::new(Duration::from_secs(10)),
duration_recorder_layer: DurationRecorderLayer::new("http.client.duration")
.on_request(OnRequestLabels::default())
.on_response(OnResponseLabels)
@@ -253,7 +248,6 @@ where
&self.follow_redirect_layer,
&self.trace_layer,
&self.trace_context_layer,
&self.timeout_layer,
)
.layer(inner)
}