http input reading correction
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2022-05-24 12:48:29 +01:00
parent 5d707bdde4
commit 29fec1466e

View File

@ -7,11 +7,15 @@ pub(super) fn handler(mut stream: UnixStream) -> i32 {
println!("entered http handler");
let mut buf = Vec::new();
loop {
let buf_len = buf.len();
buf.resize_with(buf_len + 1024, Default::default);
let mut buf_len = 0;
if stream.read(&mut buf[buf_len..]).unwrap() == 0 {
loop {
buf.resize_with(buf_len + 4096, Default::default);
let read_bytes = stream.read(&mut buf[buf_len..]).unwrap();
buf_len += read_bytes;
if read_bytes == 0 {
break;
}