index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2022-03-02 2:57:58.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2022-03-02 2:57:58.0 +00:00:00
commit
c5102af6c7ea6681fe51548a3eb448dfd74d091c [patch]
tree
83d420913673edd628f106e369cd84125d404021
parent
da85b16c396347738b7a1d4ea907eb015e1dbf62
download
c5102af6c7ea6681fe51548a3eb448dfd74d091c.tar.gz

refactor: remove unnecessary `OPTIONS` check



Diff

 src/handler.rs | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/src/handler.rs b/src/handler.rs
index 6d3262d..72842ba 100644
--- a/src/handler.rs
+++ b/src/handler.rs
@@ -1,5 +1,3 @@
use headers::{AcceptRanges, HeaderMapExt, HeaderValue};
use http::header::ALLOW;
use hyper::{header::WWW_AUTHENTICATE, Body, Method, Request, Response, StatusCode};
use std::{future::Future, path::PathBuf, sync::Arc};

@@ -152,16 +150,6 @@ impl RequestHandler {
                        security_headers::append_headers(&mut resp);
                    }

                    // Respond with the permitted communication options
                    if method == Method::OPTIONS {
                        *resp.status_mut() = StatusCode::NO_CONTENT;
                        *resp.body_mut() = Body::empty();
                        resp.headers_mut()
                            .insert(ALLOW, HeaderValue::from_static("OPTIONS, GET, HEAD"));
                        resp.headers_mut().typed_insert(AcceptRanges::bytes());
                        return Ok(resp);
                    }

                    Ok(resp)
                }
                Err(status) => error_page::error_response(