We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c3d8bf commit 65466bdCopy full SHA for 65466bd
lightning-block-sync/src/http.rs
@@ -303,9 +303,10 @@ impl HttpClient {
303
None => break,
304
Some(chunk_size) => chunk_size,
305
};
306
- let mut chunk_body = vec![0; chunk_size + "\r\n".len()];
307
- reader.read_exact(&mut chunk_body[..]).await?;
308
- content.extend_from_slice(&chunk_body[..chunk_size]);
+ let chunk_offset = content.len();
+ content.resize(chunk_offset + chunk_size + "\r\n".len(), 0);
+ reader.read_exact(&mut content[chunk_offset..]).await?;
309
+ content.resize(chunk_offset + chunk_size, 0);
310
}
311
Ok(content)
312
0 commit comments