fn headers_blocked() {
        let mut config = crate::Config::new(crate::PROTOCOL_VERSION).unwrap();
        config
            .load_cert_chain_from_pem_file("examples/cert.crt")
            .unwrap();
        config
            .load_priv_key_from_pem_file("examples/cert.key")
            .unwrap();
        config.set_application_protos(&[b"h3"]).unwrap();
        config.set_initial_max_data(70);
        config.set_initial_max_stream_data_bidi_local(150);
        config.set_initial_max_stream_data_bidi_remote(150);
        config.set_initial_max_stream_data_uni(150);
        config.set_initial_max_streams_bidi(100);
        config.set_initial_max_streams_uni(5);
        config.verify_peer(false);

        let mut h3_config = Config::new().unwrap();

        let mut s = Session::with_configs(&mut config, &mut h3_config).unwrap();

        s.handshake().unwrap();

        let req = vec![
            Header::new(b":method", b"GET"),
            Header::new(b":scheme", b"https"),
            Header::new(b":authority", b"quic.tech"),
            Header::new(b":path", b"/test"),
        ];

        assert_eq!(s.client.send_request(&mut s.pipe.client, &req, true), Ok(0));

        assert_eq!(
            s.client.send_request(&mut s.pipe.client, &req, true),
            Err(Error::StreamBlocked)
        );

        s.advance().ok();

        // Once the server gives flow control credits back, we can send the
        // request.
        assert_eq!(s.client.send_request(&mut s.pipe.client, &req, true), Ok(4));
    }
/// Tests that we limit sending HEADERS based on the stream capacity.
Tests that we limit sending HEADERS based on the stream capacity.
Tests that we limit sending HEADERS based on the stream capacity .
fn headers_blocked() {
        let mut config = crate::Config::new(crate::PROTOCOL_VERSION).unwrap();
        config
            .load_cert_chain_from_pem_file("examples/cert.crt")
            .unwrap();
        config
            .load_priv_key_from_pem_file("examples/cert.key")
            .unwrap();
        config.set_application_protos(&[b"h3"]).unwrap();
        config.set_initial_max_data(70);
        config.set_initial_max_stream_data_bidi_local(150);
        config.set_initial_max_stream_data_bidi_remote(150);
        config.set_initial_max_stream_data_uni(150);
        config.set_initial_max_streams_bidi(100);
        config.set_initial_max_streams_uni(5);
        config.verify_peer(false);
        let mut h3_config = Config::new().unwrap();
        let mut s = Session::with_configs(&mut config, &mut h3_config).unwrap();
        s.handshake().unwrap();
        let req = vec![
            Header::new(b":method", b"GET"),
            Header::new(b":scheme", b"https"),
            Header::new(b":authority", b"quic.tech"),
            Header::new(b":path", b"/test"),
        ];
        assert_eq!(s.client.send_request(&mut s.pipe.client, &req, true), Ok(0));
        assert_eq!(
            s.client.send_request(&mut s.pipe.client, &req, true),
            Err(Error::StreamBlocked)
        );
        s.advance().ok();
        // Once the server gives flow control credits back, we can send the
        // request.
        assert_eq!(s.client.send_request(&mut s.pipe.client, &req, true), Ok(4));
    }
fn headers_blocked ( ) { let mut config = crate :: Config :: new ( crate :: PROTOCOL_VERSION ) . unwrap ( ) ; config . load_cert_chain_from_pem_file ( " " ) . unwrap ( ) ; config . load_priv_key_from_pem_file ( " " ) . unwrap ( ) ; config . set_application_protos ( & [ b" " ] ) . unwrap ( ) ; config . set_initial_max_data ( 70 ) ; config . set_initial_max_stream_data_bidi_local ( 150 ) ; config . set_initial_max_stream_data_bidi_remote ( 150 ) ; config . set_initial_max_stream_data_uni ( 150 ) ; config . set_initial_max_streams_bidi ( 100 ) ; config . set_initial_max_streams_uni ( 5 ) ; config . verify_peer ( false ) ; let mut h3_config = Config :: new ( ) . unwrap ( ) ; let mut s = Session :: with_configs ( & mut config , & mut h3_config ) . unwrap ( ) ; s . handshake ( ) . unwrap ( ) ; let req = vec ! [ Header new ( b" " b" " ) Header new ( b" " b" " ) Header new ( b" " b" " ) Header new ( b" " b" " ) ] ; assert_eq ! ( s client send_request ( mut s pipe client req true ) Ok ( 0 ) ) ; assert_eq ! ( s client send_request ( mut s pipe client req true ) Err ( Error StreamBlocked ) ) ; s . advance ( ) . ok ( ) ; // Once the server gives flow control credits back, we can send the // request. assert_eq ! ( s client send_request ( mut s pipe client req true ) Ok ( 4 ) ) ; }
Tests that we limit sending HEADERS based on the stream capacity.
Tests that we limit sending HEADERS based on the stream capacity .