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
.data
.to_vec()
.chunks(1024)
.chunks(1460) // TCP MSS default size
.map(|v| Ok(Bytes::from(v.to_vec())))
.collect();
let mut resp = HttpResponse::Ok();