Axum Handler
use axum::{Router, routing::post, extract::State, body::Bytes, http::{StatusCode, header}};
use std::sync::Arc;
#[derive(Clone)]
pub struct OcspState {
pub cert_store: Arc<Mutex<CertStore>>,
pub crl_store: Arc<Mutex<CrlStore>>,
pub issuer_ca: Arc<Ca>,
}
async fn ocsp_handler(
State(state): State<OcspState>,
body: Bytes,
) -> impl IntoResponse {
match handle_ocsp_request(&state, &body) {
Ok(resp_der) => (
StatusCode::OK,
[(header::CONTENT_TYPE, "application/ocsp-response")],
resp_der,
).into_response(),
Err(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(),
}
}