/// Handles an incoming HTTP request by parsing the URL, handing over to
/// `route_request()` and replying with the produced response.
Handles an incoming HTTP request by parsing the URL, handing over to
`route_request()` and replying with the produced response.
Handles an incoming HTTP request by parsing the URL handing over to ` route_request () ` and replying with the produced response .
fn handle_http_request(
    request: Request<Body>,
    certified_stream_store: &dyn CertifiedStreamStore,
    base_url: &Url,
    metrics: &XNetEndpointMetrics,
    log: &ReplicaLogger,
) -> Response<Body> {
    match base_url.join(
        request
            .uri()
            .path_and_query()
            .map(|pq| pq.as_str())
            .unwrap_or(""),
    ) {
        Ok(url) => route_request(url, certified_stream_store, metrics),
        Err(e) => {
            let msg = format!("Invalid URL {}: {}", request.uri(), e);
            warn!(log, "{}", msg);
            bad_request(msg)
        }
    }
}
fn handle_http_request ( request : Request < Body > , certified_stream_store : & dyn CertifiedStreamStore , base_url : & Url , metrics : & XNetEndpointMetrics , log : & ReplicaLogger , ) -> Response < Body > { match base_url . join ( request . uri ( ) . path_and_query ( ) . map ( | pq | pq . as_str ( ) ) . unwrap_or ( " " ) , ) { Ok ( url ) => route_request ( url , certified_stream_store , metrics ) , Err ( e ) => { let msg = format ! ( " " request uri ( ) e ) ; warn ! ( log " " msg ) ; bad_request ( msg ) } } }
Handles an incoming HTTP request by parsing the URL, handing over to
`route_request()` and replying with the produced response.
Handles an incoming HTTP request by parsing the URL handing over to ` route_request () ` and replying with the produced response .
request
Request<Body>
certified_stream_store
&dyn CertifiedStreamStore
base_url
&Url
metrics
&XNetEndpointMetrics
log
&ReplicaLogger