Browse Source

[core] alloc optim reading file, sending chunked

avoid potential double-copy due to not enough space for final '\0'
in http_chunk_append_read_fd_range() if read size is exactly multiple
of 8k and sending chunked response
master
Glenn Strauss 7 months ago
parent
commit
9c25581d6f
  1. 2
      src/http_chunk.c

2
src/http_chunk.c

@ -77,7 +77,7 @@ static int http_chunk_append_read_fd_range(request_st * const r, const buffer *
http_chunk_len_append(cq, (uintmax_t)len);
if (0 != offset && -1 == lseek(fd, offset, SEEK_SET)) return -1;
buffer * const b = chunkqueue_append_buffer_open_sz(cq, len+2);
buffer * const b = chunkqueue_append_buffer_open_sz(cq, len+2+1);
ssize_t rd;
offset = 0;
do {

Loading…
Cancel
Save