File tree Expand file tree Collapse file tree 3 files changed +16
-17
lines changed Expand file tree Collapse file tree 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 {
153153 let host = self
154154 . parts
155155 . headers ( )
156- . get ( "host" )
156+ . get ( http :: header :: HOST )
157157 . map ( |h| h. to_str ( ) . unwrap_or ( "" ) )
158158 . unwrap_or ( "" ) ;
159159 Host :: Name ( host)
Original file line number Diff line number Diff line change 11#![ deny( clippy:: all, missing_debug_implementations, rust_2018_idioms) ]
2- #![ allow( clippy:: needless_doctest_main, clippy:: unknown_clippy_lints) ] // using the tokio::main attribute
32
43//! A wrapper for integrating `hyper 0.13` with a `conduit 0.8` blocking application stack.
54//!
@@ -57,17 +56,3 @@ pub use service::{BlockingHandler, Service};
5756
5857type HyperResponse = hyper:: Response < hyper:: Body > ;
5958type 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 11use crate :: adaptor:: { ConduitRequest , RequestInfo } ;
2+ use crate :: file_stream:: FileStream ;
23use crate :: service:: ServiceError ;
3- use crate :: { conduit_into_hyper , HyperResponse } ;
4+ use crate :: { ConduitResponse , HyperResponse } ;
45
56use std:: net:: SocketAddr ;
67use std:: sync:: {
@@ -60,6 +61,19 @@ impl<H: Handler> BlockingHandler<H> {
6061 }
6162}
6263
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+
6377/// Logs an error message and returns a generic status 500 response
6478fn server_error_response ( message : & str ) -> HyperResponse {
6579 error ! ( "Internal Server Error: {}" , message) ;
You can’t perform that action at this time.
0 commit comments