diff options
Diffstat (limited to 'src/request')
| -rw-r--r-- | src/request/response.rs | 13 | ||||
| -rw-r--r-- | src/request/status.rs | 2 | ||||
| -rw-r--r-- | src/request/verifier.rs | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/request/response.rs b/src/request/response.rs index 0202967..e96cee0 100644 --- a/src/request/response.rs +++ b/src/request/response.rs @@ -29,21 +29,18 @@ pub struct Response { pub suite: Option<SupportedCipherSuite>, } impl Response { - pub(super) fn new( - data: Vec<u8>, - suite: Option<SupportedCipherSuite>, - ) -> Self { - let string_form = String::from_utf8_lossy(&data).to_string(); + pub(super) fn new(data: &[u8], suite: Option<SupportedCipherSuite>) -> Self { + let string_form = String::from_utf8_lossy(data).to_string(); let mut content = None; let header; - if !string_form.ends_with("\r\n") { + if string_form.ends_with("\r\n") { + header = string_form; + } else { let mut string_split = string_form.split("\r\n"); header = string_split.next().unwrap_or("").to_string(); content = Some(string_split.collect()); - } else { - header = string_form; } let header_split = header.split_at(2); diff --git a/src/request/status.rs b/src/request/status.rs index b2065ed..8a18ce7 100644 --- a/src/request/status.rs +++ b/src/request/status.rs @@ -72,7 +72,7 @@ impl From<Status> for i32 { Status::ClientCertificateRequired => 60, Status::CertificateNotAuthorised => 61, Status::CertificateNotValid => 62, - _ => 0, + Status::Unsupported => 0, } } } diff --git a/src/request/verifier.rs b/src/request/verifier.rs index f2c6a35..d6511c3 100644 --- a/src/request/verifier.rs +++ b/src/request/verifier.rs @@ -22,7 +22,7 @@ use rustls::{client, client::ServerCertVerified, Certificate}; pub(super) struct GermVerifier; impl GermVerifier { - pub fn new() -> Self { Self {} } + pub const fn new() -> Self { Self {} } } impl client::ServerCertVerifier for GermVerifier { fn verify_server_cert( |