Renamed methods to match spec

This commit is contained in:
Emi Tatsuo 2020-11-13 17:54:06 -05:00
parent eaee14d174
commit 168bb56aa2
Signed by: Emi
GPG Key ID: 68FAB2E2E6DFC98B
2 changed files with 7 additions and 7 deletions

View File

@ -57,7 +57,7 @@ fn handle_request(users: Arc<RwLock<HashMap<CertBytes, String>>>, request: Reque
}
} else {
// The user didn't provide a certificate
Response::needs_certificate()
Response::client_certificate_required()
}
}.boxed()
}

View File

@ -109,14 +109,14 @@ impl ResponseHeader {
})
}
pub fn needs_certificate() -> Result<Self> {
pub fn client_certificate_required() -> Result<Self> {
Ok(Self {
status: Status::CLIENT_CERTIFICATE_REQUIRED,
meta: Meta::new("No certificate provided")?,
})
}
pub fn not_authorized() -> Result<Self> {
pub fn certificate_not_authorized() -> Result<Self> {
Ok(Self {
status: Status::CERTIFICATE_NOT_AUTHORIZED,
meta: Meta::new("Your certificate is not authorized to view this content")?,
@ -271,13 +271,13 @@ impl Response {
Ok(Self::new(header))
}
pub fn needs_certificate() -> Result<Self> {
let header = ResponseHeader::needs_certificate()?;
pub fn client_certificate_required() -> Result<Self> {
let header = ResponseHeader::client_certificate_required()?;
Ok(Self::new(header))
}
pub fn not_authorized() -> Result<Self> {
let header = ResponseHeader::not_authorized()?;
pub fn certificate_not_authorized() -> Result<Self> {
let header = ResponseHeader::certificate_not_authorized()?;
Ok(Self::new(header))
}