File tree 3 files changed +16
-17
lines changed
3 files changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ impl RequestExt for ConduitRequest {
153
153
let host = self
154
154
. parts
155
155
. headers ( )
156
- . get ( "host" )
156
+ . get ( http :: header :: HOST )
157
157
. map ( |h| h. to_str ( ) . unwrap_or ( "" ) )
158
158
. unwrap_or ( "" ) ;
159
159
Host :: Name ( host)
Original file line number Diff line number Diff line change 1
1
#![ deny( clippy:: all, missing_debug_implementations, rust_2018_idioms) ]
2
- #![ allow( clippy:: needless_doctest_main, clippy:: unknown_clippy_lints) ] // using the tokio::main attribute
3
2
4
3
//! A wrapper for integrating `hyper 0.13` with a `conduit 0.8` blocking application stack.
5
4
//!
@@ -57,17 +56,3 @@ pub use service::{BlockingHandler, Service};
57
56
58
57
type HyperResponse = hyper:: Response < hyper:: Body > ;
59
58
type ConduitResponse = conduit:: Response < conduit:: Body > ;
60
- use crate :: file_stream:: FileStream ;
61
-
62
- /// Turns a `ConduitResponse` into a `HyperResponse`
63
- fn conduit_into_hyper ( response : ConduitResponse ) -> HyperResponse {
64
- use conduit:: Body :: * ;
65
-
66
- let ( parts, body) = response. into_parts ( ) ;
67
- let body = match body {
68
- Static ( slice) => slice. into ( ) ,
69
- Owned ( vec) => vec. into ( ) ,
70
- File ( file) => FileStream :: from_std ( file) . into_streamed_body ( ) ,
71
- } ;
72
- HyperResponse :: from_parts ( parts, body)
73
- }
Original file line number Diff line number Diff line change 1
1
use crate :: adaptor:: { ConduitRequest , RequestInfo } ;
2
+ use crate :: file_stream:: FileStream ;
2
3
use crate :: service:: ServiceError ;
3
- use crate :: { conduit_into_hyper , HyperResponse } ;
4
+ use crate :: { ConduitResponse , HyperResponse } ;
4
5
5
6
use std:: net:: SocketAddr ;
6
7
use std:: sync:: {
@@ -60,6 +61,19 @@ impl<H: Handler> BlockingHandler<H> {
60
61
}
61
62
}
62
63
64
+ /// Turns a `ConduitResponse` into a `HyperResponse`
65
+ fn conduit_into_hyper ( response : ConduitResponse ) -> HyperResponse {
66
+ use conduit:: Body :: * ;
67
+
68
+ let ( parts, body) = response. into_parts ( ) ;
69
+ let body = match body {
70
+ Static ( slice) => slice. into ( ) ,
71
+ Owned ( vec) => vec. into ( ) ,
72
+ File ( file) => FileStream :: from_std ( file) . into_streamed_body ( ) ,
73
+ } ;
74
+ HyperResponse :: from_parts ( parts, body)
75
+ }
76
+
63
77
/// Logs an error message and returns a generic status 500 response
64
78
fn server_error_response ( message : & str ) -> HyperResponse {
65
79
error ! ( "Internal Server Error: {}" , message) ;
You can’t perform that action at this time.
0 commit comments