Skip to content

Commit 759deb5

Browse files
authored
docs: update client-http1-middleware docs (#262)
1 parent 251eca7 commit 759deb5

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/client/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
/// Legacy implementations of `connect` module and `Client`
44
#[cfg(feature = "client-legacy")]
55
pub mod legacy;
6-
pub mod service;
76

87
#[cfg(feature = "client-pool")]
98
pub mod pool;
109

10+
#[cfg(feature = "client-pool")]
11+
pub mod service;
12+
1113
#[cfg(feature = "client-proxy")]
1214
pub mod proxy;

src/client/service.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
//! todo
1+
//! Middleware services for normalizing request URIs and Host headers.
22
33
use std::task::{Context, Poll};
44

55
use http::header::{HeaderValue, HOST};
66
use http::{Method, Request, Uri};
77
use tower_service::Service;
88

9-
/// todo
9+
/// A middleware that ensures the Host header matches the URI's authority.
10+
///
11+
/// Particularly useful for HTTP/1 clients and proxies, where the Host
12+
/// header is mandatory and should be derived from the request URI.
1013
#[derive(Clone, Debug)]
1114
pub struct SetHost<S> {
1215
inner: S,
1316
}
1417

15-
/// todo
18+
/// A middleware that modifies the request target for HTTP/1 semantics.
19+
///
20+
/// Ensures CONNECT uses authority-form, and all other methods use origin-form.
1621
#[derive(Clone, Debug)]
1722
pub struct Http1RequestTarget<S> {
1823
inner: S,
@@ -21,7 +26,7 @@ pub struct Http1RequestTarget<S> {
2126
// ===== impl SetHost =====
2227

2328
impl<S> SetHost<S> {
24-
/// todo
29+
/// Create a new `SetHost` middleware wrapping the given service.
2530
pub fn new(inner: S) -> Self {
2631
SetHost { inner }
2732
}
@@ -79,7 +84,7 @@ fn is_schema_secure(uri: &Uri) -> bool {
7984
// ===== impl Http1RequestTarget =====
8085

8186
impl<S> Http1RequestTarget<S> {
82-
/// todo
87+
/// Create a new `Http1RequestTarget` middleware wrapping the given service.
8388
pub fn new(inner: S) -> Self {
8489
Http1RequestTarget { inner }
8590
}

0 commit comments

Comments
 (0)