Skip to content

Commit

Permalink
reuse buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper64 committed Feb 18, 2024
1 parent a71b427 commit a3307f4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions vlib/x/vweb/vweb.v
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,9 @@ fn handle_read[A, X](mut pv picoev.Picoev, mut params RequestParams, fd int) {
mut reader := if !is_first_data_of_request {
// the previous request was incomplete, append incoming data to the buffer
// so the request headers can be parsed again in their entirety
max_size := incoming_req.buf.len + vweb.max_read
mut new_buf := []u8{len: max_size, cap: max_size}
// copy the previous request buffer to the new buffered reader
copy(mut new_buf, incoming_req.buf)
&io.BufferedReader{
reader: conn
buf: new_buf
buf: incoming_req.buf
len: incoming_req.buf.len
offset: 0
mfails: 2
Expand Down

0 comments on commit a3307f4

Please sign in to comment.