fn zero_length_data_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(69);
        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, false),
            Ok(0)
        );

        assert_eq!(
            s.client.send_body(&mut s.pipe.client, 0, b"", true),
            Err(Error::Done)
        );

        s.advance().ok();

        // Once the server gives flow control credits back, we can send the body.
        assert_eq!(s.client.send_body(&mut s.pipe.client, 0, b"", true), Ok(0));
    }
/// Tests that blocked 0-length DATA writes are reported correctly.
Tests that blocked 0-length DATA writes are reported correctly.
Tests that blocked 0 - length DATA writes are reported correctly .
fn zero_length_data_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(69);
        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, false),
            Ok(0)
        );
        assert_eq!(
            s.client.send_body(&mut s.pipe.client, 0, b"", true),
            Err(Error::Done)
        );
        s.advance().ok();
        // Once the server gives flow control credits back, we can send the body.
        assert_eq!(s.client.send_body(&mut s.pipe.client, 0, b"", true), Ok(0));
    }
fn zero_length_data_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 ( 69 ) ; 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 false ) Ok ( 0 ) ) ; assert_eq ! ( s client send_body ( mut s pipe client 0 b" " true ) Err ( Error Done ) ) ; s . advance ( ) . ok ( ) ; // Once the server gives flow control credits back, we can send the body. assert_eq ! ( s client send_body ( mut s pipe client 0 b" " true ) Ok ( 0 ) ) ; }
Tests that blocked 0-length DATA writes are reported correctly.
Tests that blocked 0 - length DATA writes are reported correctly .