fn headers_blocked_on_conn() {
        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();

        // After the HTTP handshake, some bytes of connection flow control have
        // been consumed. Fill the connection with more grease data on the control
        // stream.
        let d = [42; 28];
        assert_eq!(s.pipe.client.stream_send(2, &d, false), Ok(23));

        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"),
        ];

        // There is 0 connection-level flow control, so sending a request is
        // blocked.
        assert_eq!(
            s.client.send_request(&mut s.pipe.client, &req, true),
            Err(Error::StreamBlocked)
        );

        // Emit the control stream data and drain it at the server via poll() to
        // consumes it via poll() and gives back flow control.
        s.advance().ok();
        assert_eq!(s.poll_server(), Err(Error::Done));
        s.advance().ok();

        // Now we can send the request.
        assert_eq!(s.client.send_request(&mut s.pipe.client, &req, true), Ok(0));
    }
/// Ensure StreamBlocked when connection flow control prevents headers.
Ensure StreamBlocked when connection flow control prevents headers.
Ensure StreamBlocked when connection flow control prevents headers .
fn headers_blocked_on_conn() {
        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();
        // After the HTTP handshake, some bytes of connection flow control have
        // been consumed. Fill the connection with more grease data on the control
        // stream.
        let d = [42; 28];
        assert_eq!(s.pipe.client.stream_send(2, &d, false), Ok(23));
        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"),
        ];
        // There is 0 connection-level flow control, so sending a request is
        // blocked.
        assert_eq!(
            s.client.send_request(&mut s.pipe.client, &req, true),
            Err(Error::StreamBlocked)
        );
        // Emit the control stream data and drain it at the server via poll() to
        // consumes it via poll() and gives back flow control.
        s.advance().ok();
        assert_eq!(s.poll_server(), Err(Error::Done));
        s.advance().ok();
        // Now we can send the request.
        assert_eq!(s.client.send_request(&mut s.pipe.client, &req, true), Ok(0));
    }
fn headers_blocked_on_conn ( ) { 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 ( ) ; // After the HTTP handshake, some bytes of connection flow control have // been consumed. Fill the connection with more grease data on the control // stream. let d = [ 42 ; 28 ] ; assert_eq ! ( s pipe client stream_send ( 2 d false ) Ok ( 23 ) ) ; let req = vec ! [ Header new ( b" " b" " ) Header new ( b" " b" " ) Header new ( b" " b" " ) Header new ( b" " b" " ) ] ; // There is 0 connection-level flow control, so sending a request is // blocked. assert_eq ! ( s client send_request ( mut s pipe client req true ) Err ( Error StreamBlocked ) ) ; // Emit the control stream data and drain it at the server via poll() to // consumes it via poll() and gives back flow control. s . advance ( ) . ok ( ) ; assert_eq ! ( s poll_server ( ) Err ( Error Done ) ) ; s . advance ( ) . ok ( ) ; // Now we can send the request. assert_eq ! ( s client send_request ( mut s pipe client req true ) Ok ( 0 ) ) ; }
Ensure StreamBlocked when connection flow control prevents headers.
Ensure StreamBlocked when connection flow control prevents headers .