Browse Source

[core] fix chunkqueue_small_resp_optim partial rd

master
Glenn Strauss 9 months ago
parent
commit
e8de53cb74
  1. 4
      src/chunk.c
  2. 4
      src/http_chunk.c

4
src/chunk.c

@ -1155,9 +1155,11 @@ chunkqueue_small_resp_optim (chunkqueue * const restrict cq)
ssize_t rd;
offset = 0; /*(reuse offset var for offset into mem buffer)*/
do {
rd = read(fd, ptr+offset, len-offset);
rd = read(fd, ptr+offset, (size_t)len);
} while (rd > 0 ? (offset += rd, len -= rd) : errno == EINTR);
/*(contents of chunkqueue kept valid even if error reading from file)*/
if (len)
cq->bytes_in -= len;
buffer_commit(b, offset);
filec->offset += offset;
chunkqueue_remove_empty_chunks(cq);

4
src/http_chunk.c

@ -81,8 +81,8 @@ static int http_chunk_append_read_fd_range(request_st * const r, const buffer *
ssize_t rd;
offset = 0;
do {
rd = read(fd, b->ptr+offset, len-offset);
} while (rd > 0 ? (offset += rd, len -= rd) : errno == EINTR);
rd = read(fd, b->ptr+offset, (size_t)(len-offset));
} while (rd > 0 ? (offset += rd) != len : errno == EINTR);
buffer_commit(b, offset);
if (r->resp_send_chunked)

Loading…
Cancel
Save