@@ -1215,6 +1215,48 @@ async fn allow_empty_data_for_head() {
|
||||
join(srv, h2).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn early_hints() {
|
||||
h2_support::trace_init!();
|
||||
let (io, mut srv) = mock::new();
|
||||
|
||||
let srv = async move {
|
||||
let settings = srv.assert_client_handshake().await;
|
||||
assert_default_settings!(settings);
|
||||
srv.recv_frame(
|
||||
frames::headers(1)
|
||||
.request("GET", "https://example.com/")
|
||||
.eos(),
|
||||
)
|
||||
.await;
|
||||
srv.send_frame(frames::headers(1).response(103)).await;
|
||||
srv.send_frame(frames::headers(1).response(200).field("content-length", 2))
|
||||
.await;
|
||||
srv.send_frame(frames::data(1, "ok").eos()).await;
|
||||
};
|
||||
|
||||
let h2 = async move {
|
||||
let (mut client, h2) = client::Builder::new()
|
||||
.handshake::<_, Bytes>(io)
|
||||
.await
|
||||
.unwrap();
|
||||
tokio::spawn(async {
|
||||
h2.await.expect("connection failed");
|
||||
});
|
||||
let request = Request::builder()
|
||||
.method(Method::GET)
|
||||
.uri("https://example.com/")
|
||||
.body(())
|
||||
.unwrap();
|
||||
let (response, _) = client.send_request(request, true).unwrap();
|
||||
let (ha, mut body) = response.await.unwrap().into_parts();
|
||||
eprintln!("{:?}", ha);
|
||||
assert_eq!(body.data().await.unwrap().unwrap(), "ok");
|
||||
};
|
||||
|
||||
join(srv, h2).await;
|
||||
}
|
||||
|
||||
const SETTINGS: &'static [u8] = &[0, 0, 0, 4, 0, 0, 0, 0, 0];
|
||||
const SETTINGS_ACK: &'static [u8] = &[0, 0, 0, 4, 1, 0, 0, 0, 0];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user