Merge pull request #46 from greatest-ape/work-2022-01-31

http: don't panic if response body is too long for buffer; update README
This commit is contained in:
Joakim Frostegård 2022-01-31 20:37:44 +01:00 committed by GitHub
commit e629d49448
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -1,4 +1,4 @@
# aquatic
# aquatic: high-performance BitTorrent tracker
[![CargoBuildAndTest](https://github.com/greatest-ape/aquatic/actions/workflows/cargo-build-and-test.yml/badge.svg)](https://github.com/greatest-ape/aquatic/actions/workflows/cargo-build-and-test.yml) [![Test HTTP, UDP and WSS file transfer](https://github.com/greatest-ape/aquatic/actions/workflows/test-transfer.yml/badge.svg)](https://github.com/greatest-ape/aquatic/actions/workflows/test-transfer.yml)

View file

@ -429,6 +429,12 @@ impl Connection {
position += body_len;
if position + 2 > self.response_buffer.len() {
::log::error!("Response buffer is too short for response");
return Err(anyhow::anyhow!("Response buffer is too short for response"));
}
(&mut self.response_buffer[position..position + 2]).copy_from_slice(b"\r\n");
position += 2;