Skip to content

Commit bbf51eb

Browse files
technetosyoshuawuyts
authored andcommitted
Introduce basic example to reproduce bug
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent 1b2e769 commit bbf51eb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

examples/server.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ async fn accept(addr: String, stream: TcpStream) -> Result<(), async_h1::Excepti
1616
// TODO: Delete this line when we implement `Clone` for `TcpStream`.
1717
let stream = Stream(Arc::new(stream));
1818

19-
server::accept(&addr, stream.clone(), stream, |_| {
19+
server::accept(&addr, stream.clone(), stream, |req| {
2020
async {
21+
let mut body = vec![];
22+
req.read_to_end(&mut body).await?;
23+
2124
let mut resp = Response::new(StatusCode::Ok);
2225
resp.insert_header(
2326
HeaderName::from_str("Content-Type")?,
2427
HeaderValue::from_str("text/plain")?,
2528
)?;
2629
resp.set_body("Hello");
30+
2731
// To try chunked encoding, replace `set_body_string` with the following method call
2832
// .set_body(io::Cursor::new(vec![
2933
// 0x48u8, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub use check::check;
4040

4141
mod check;
4242

43-
pub mod client;
43+
//pub mod client;
4444
pub mod server;
4545

4646
mod date;

0 commit comments

Comments
 (0)