File tree Expand file tree Collapse file tree 5 files changed +17
-15
lines changed Expand file tree Collapse file tree 5 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ const CR: u8 = b'\r';
16
16
const LF : u8 = b'\n' ;
17
17
18
18
/// Decode an HTTP response on the client.
19
- #[ doc( hidden) ]
20
19
pub async fn decode < R > ( reader : R ) -> http_types:: Result < Response >
21
20
where
22
21
R : Read + Unpin + Send + Sync + ' static ,
Original file line number Diff line number Diff line change @@ -106,9 +106,8 @@ const MAX_HEAD_LENGTH: usize = 8 * 1024;
106
106
107
107
mod chunked;
108
108
mod date;
109
- mod server;
109
+ pub mod server;
110
110
111
- #[ doc( hidden) ]
112
111
pub mod client;
113
112
114
113
pub use client:: connect;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const LF: u8 = b'\n';
17
17
const HTTP_1_1_VERSION : u8 = 1 ;
18
18
19
19
/// Decode an HTTP request on the server.
20
- pub ( crate ) async fn decode < IO > ( mut io : IO ) -> http_types:: Result < Option < Request > >
20
+ pub async fn decode < IO > ( mut io : IO ) -> http_types:: Result < Option < Request > >
21
21
where
22
22
IO : Read + Write + Clone + Send + Sync + Unpin + ' static ,
23
23
{
@@ -116,13 +116,17 @@ fn set_url_and_port_from_host_header(req: &mut Request) -> http_types::Result<()
116
116
. ok_or_else ( || format_err ! ( "Mandatory Host header missing" ) ) ? // https://tools.ietf.org/html/rfc7230#section-5.4
117
117
. to_string ( ) ;
118
118
119
- if let Some ( colon) = host. find ( ":" ) {
120
- req. url_mut ( ) . set_host ( Some ( & host[ 0 ..colon] ) ) ?;
121
- req. url_mut ( )
122
- . set_port ( host[ colon + 1 ..] . parse ( ) . ok ( ) )
123
- . unwrap ( ) ;
124
- } else {
125
- req. url_mut ( ) . set_host ( Some ( & host) ) ?;
119
+ if !req. url ( ) . cannot_be_a_base ( ) {
120
+ if let Some ( colon) = host. find ( ":" ) {
121
+ println ! ( "AAAA" ) ;
122
+ req. url_mut ( ) . set_host ( Some ( & host[ 0 ..colon] ) ) ?;
123
+ println ! ( "AAAA" ) ;
124
+ req. url_mut ( )
125
+ . set_port ( host[ colon + 1 ..] . parse ( ) . ok ( ) )
126
+ . unwrap ( ) ;
127
+ } else {
128
+ req. url_mut ( ) . set_host ( Some ( & host) ) ?;
129
+ }
126
130
}
127
131
128
132
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ use crate::date::fmt_http_date;
15
15
///
16
16
/// This is returned from [`encode`].
17
17
#[ derive( Debug ) ]
18
- pub ( crate ) struct Encoder {
18
+ pub struct Encoder {
19
19
/// The current level of recursion the encoder is in.
20
20
depth : u16 ,
21
21
/// HTTP headers to be sent.
@@ -69,7 +69,7 @@ impl Read for Encoder {
69
69
70
70
impl Encoder {
71
71
/// Create a new instance of Encoder.
72
- pub ( crate ) fn new ( res : Response ) -> Self {
72
+ pub fn new ( res : Response ) -> Self {
73
73
Self {
74
74
res,
75
75
depth : 0 ,
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ use http_types::{Request, Response};
10
10
mod decode;
11
11
mod encode;
12
12
13
- use decode:: decode;
14
- use encode:: Encoder ;
13
+ pub use decode:: decode;
14
+ pub use encode:: Encoder ;
15
15
16
16
/// Configure the server.
17
17
#[ derive( Debug , Clone ) ]
You can’t perform that action at this time.
0 commit comments