use TCP MSS as chunk size

This commit is contained in:
Edward Shen 2021-03-23 15:31:59 -04:00
parent 46eec93773
commit cf82aedb12
Signed by: edward
GPG key ID: 19182661E818369F

View file

@ -250,7 +250,7 @@ fn construct_response(cached: &CachedImage) -> ServerResponse {
let data: Vec<Result<Bytes, Infallible>> = cached let data: Vec<Result<Bytes, Infallible>> = cached
.data .data
.to_vec() .to_vec()
.chunks(1024) .chunks(1460) // TCP MSS default size
.map(|v| Ok(Bytes::from(v.to_vec()))) .map(|v| Ok(Bytes::from(v.to_vec())))
.collect(); .collect();
let mut resp = HttpResponse::Ok(); let mut resp = HttpResponse::Ok();