Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions apps/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ pub struct Http3Conn {
dump_json: bool,
dgram_sender: Option<Http3DgramSender>,
output_sink: Rc<RefCell<dyn FnMut(String)>>,
stdout_writer: std::io::BufWriter<std::io::Stdout>,
}

impl Http3Conn {
Expand Down Expand Up @@ -857,6 +858,7 @@ impl Http3Conn {
dump_json: dump_json.is_some(),
dgram_sender,
output_sink,
stdout_writer: std::io::BufWriter::new(std::io::stdout()),
};

Box::new(h_conn)
Expand Down Expand Up @@ -889,6 +891,7 @@ impl Http3Conn {
dump_json: false,
dgram_sender,
output_sink,
stdout_writer: std::io::BufWriter::new(std::io::stdout()),
};

Ok(Box::new(h_conn))
Expand Down Expand Up @@ -1270,11 +1273,7 @@ impl HttpConn for Http3Conn {

None =>
if !self.dump_json {
self.output_sink.borrow_mut()(unsafe {
String::from_utf8_unchecked(
buf[..read].to_vec(),
)
});
self.stdout_writer.write_all(&buf[..read]).ok();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the from_utf8_unchecked() then we risk binary being printed to stdout, which can cause terminal corruption

Copy link
Author

@Geun-Oh Geun-Oh Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your right.
And I found that it seems normal to take time when calling large file. I need to check real issue situation and debug it again.

I've asked the one who issued this to provide reproducible example.

},
}
}
Expand Down