refactor http handler
This commit is contained in:
parent
2e3216019b
commit
a40d8a0072
7 changed files with 91 additions and 72 deletions
|
|
@ -5,11 +5,13 @@ use hyper::{Body, Request, Response, StatusCode, Uri};
|
|||
////////////////////////////////////////////////////
|
||||
// Functions to create response (error or redirect)
|
||||
|
||||
/// Generate a synthetic response message of a certain error status code
|
||||
pub(super) fn http_error(status_code: StatusCode) -> Result<Response<Body>> {
|
||||
let response = Response::builder().status(status_code).body(Body::empty())?;
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
/// Generate synthetic response message of a redirection to https host with 301
|
||||
pub(super) fn secure_redirection<B>(
|
||||
server_name: &str,
|
||||
tls_port: Option<u16>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue