fn handle_request(
    client: &mut Client, stream_id: u64, headers: &[quiche::h3::Header],
    root: &str,
) {
    let conn = &mut client.conn;
    let http3_conn = &mut client.http3_conn.as_mut().unwrap();

    info!(
        "{} got request {:?} on stream id {}",
        conn.trace_id(),
        hdrs_to_strings(headers),
        stream_id
    );

    // We decide the response based on headers alone, so stop reading the
    // request stream so that any body is ignored and pointless Data events
    // are not generated.
    conn.stream_shutdown(stream_id, quiche::Shutdown::Read, 0)
        .unwrap();

    let (headers, body) = build_response(root, headers);

    match http3_conn.send_response(conn, stream_id, &headers, false) {
        Ok(v) => v,

        Err(quiche::h3::Error::StreamBlocked) => {
            let response = PartialResponse {
                headers: Some(headers),
                body,
                written: 0,
            };

            client.partial_responses.insert(stream_id, response);
            return;
        },

        Err(e) => {
            error!("{} stream send failed {:?}", conn.trace_id(), e);
            return;
        },
    }

    let written = match http3_conn.send_body(conn, stream_id, &body, true) {
        Ok(v) => v,

        Err(quiche::h3::Error::Done) => 0,

        Err(e) => {
            error!("{} stream send failed {:?}", conn.trace_id(), e);
            return;
        },
    };

    if written < body.len() {
        let response = PartialResponse {
            headers: None,
            body,
            written,
        };

        client.partial_responses.insert(stream_id, response);
    }
}
/// Handles incoming HTTP/3 requests.
Handles incoming HTTP/3 requests.
Handles incoming HTTP / 3 requests .
fn handle_request(
    client: &mut Client, stream_id: u64, headers: &[quiche::h3::Header],
    root: &str,
) {
    let conn = &mut client.conn;
    let http3_conn = &mut client.http3_conn.as_mut().unwrap();
    info!(
        "{} got request {:?} on stream id {}",
        conn.trace_id(),
        hdrs_to_strings(headers),
        stream_id
    );
    // We decide the response based on headers alone, so stop reading the
    // request stream so that any body is ignored and pointless Data events
    // are not generated.
    conn.stream_shutdown(stream_id, quiche::Shutdown::Read, 0)
        .unwrap();
    let (headers, body) = build_response(root, headers);
    match http3_conn.send_response(conn, stream_id, &headers, false) {
        Ok(v) => v,
        Err(quiche::h3::Error::StreamBlocked) => {
            let response = PartialResponse {
                headers: Some(headers),
                body,
                written: 0,
            };
            client.partial_responses.insert(stream_id, response);
            return;
        },
        Err(e) => {
            error!("{} stream send failed {:?}", conn.trace_id(), e);
            return;
        },
    }
    let written = match http3_conn.send_body(conn, stream_id, &body, true) {
        Ok(v) => v,
        Err(quiche::h3::Error::Done) => 0,
        Err(e) => {
            error!("{} stream send failed {:?}", conn.trace_id(), e);
            return;
        },
    };
    if written < body.len() {
        let response = PartialResponse {
            headers: None,
            body,
            written,
        };
        client.partial_responses.insert(stream_id, response);
    }
}
fn handle_request ( client : & mut Client , stream_id : u64 , headers : & [ quiche :: h3 :: Header ] , root : & str , ) { let conn = & mut client . conn ; let http3_conn = & mut client . http3_conn . as_mut ( ) . unwrap ( ) ; info ! ( " " conn trace_id ( ) hdrs_to_strings ( headers ) stream_id ) ; // We decide the response based on headers alone, so stop reading the // request stream so that any body is ignored and pointless Data events // are not generated. conn . stream_shutdown ( stream_id , quiche :: Shutdown :: Read , 0 ) . unwrap ( ) ; let ( headers , body ) = build_response ( root , headers ) ; match http3_conn . send_response ( conn , stream_id , & headers , false ) { Ok ( v ) => v , Err ( quiche :: h3 :: Error :: StreamBlocked ) => { let response = PartialResponse { headers : Some ( headers ) , body , written : 0 , } ; client . partial_responses . insert ( stream_id , response ) ; return ; } , Err ( e ) => { error ! ( " " conn trace_id ( ) e ) ; return ; } , } let written = match http3_conn . send_body ( conn , stream_id , & body , true ) { Ok ( v ) => v , Err ( quiche :: h3 :: Error :: Done ) => 0 , Err ( e ) => { error ! ( " " conn trace_id ( ) e ) ; return ; } , } ; if written < body . len ( ) { let response = PartialResponse { headers : None , body , written , } ; client . partial_responses . insert ( stream_id , response ) ; } }
Handles incoming HTTP/3 requests.
Handles incoming HTTP / 3 requests .
client
&mut Client
stream_id
u64
headers
&[quiche::h3::Header]
root
&str
client
&mut Client
stream_id
u64
headers
&[quiche::h3::Header]
root
&str