diff options
author | Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com> | 2021-10-13 02:09:04 +0000 |
---|---|---|
committer | Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com> | 2021-10-13 02:09:04 +0000 |
commit | 251f20858d8e48ebc045cfdd997c1e40dffdbf11 (patch) | |
tree | 285cc75e3b5a9188d1c782ac21df572d48a0c5fe /src/errors.rs | |
parent | Merge pull request #613 from svenstaro/dependabot/cargo/assert_fs-1.0.6 (diff) | |
download | miniserve-251f20858d8e48ebc045cfdd997c1e40dffdbf11.tar.gz miniserve-251f20858d8e48ebc045cfdd997c1e40dffdbf11.zip |
revert unnecessary changes
Diffstat (limited to '')
-rw-r--r-- | src/errors.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/errors.rs b/src/errors.rs index 25d0529..c6fcce3 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -58,10 +58,6 @@ pub enum ContextualError { #[error("{0}")] ArchiveCreationDetailError(String), - /// Might occur when the HTTP credentials are not provided - #[error("Access requires HTTP authentication")] - RequireHttpCredentials, - /// Might occur when the HTTP credentials are not correct #[error("Invalid credentials for HTTP authentication")] InvalidHttpCredentials, @@ -90,20 +86,17 @@ impl ResponseError for ContextualError { Self::ArchiveCreationError(_, err) => err.status_code(), Self::RouteNotFoundError(_) => StatusCode::NOT_FOUND, Self::InsufficientPermissionsError(_) => StatusCode::FORBIDDEN, - Self::InvalidHttpCredentials | Self::RequireHttpCredentials => StatusCode::UNAUTHORIZED, + Self::InvalidHttpCredentials => StatusCode::UNAUTHORIZED, Self::InvalidHttpRequestError(_) => StatusCode::BAD_REQUEST, _ => StatusCode::INTERNAL_SERVER_ERROR, } } fn error_response(&self) -> HttpResponse { - if let Self::RequireHttpCredentials = self { - } else { - log_error_chain(self.to_string()); - } + log_error_chain(self.to_string()); let mut resp = HttpResponse::build(self.status_code()); - if let Self::RequireHttpCredentials | Self::InvalidHttpCredentials = self { + if let Self::InvalidHttpCredentials = self { resp.append_header(( header::WWW_AUTHENTICATE, header::HeaderValue::from_static("Basic realm=\"miniserve\""), |