Browse Source

[core] chunkqueue_append_buffer always clears buf

chunkqueue_append_buffer() always clears buffer
(instead of relying on caller to do so after the call)
master
Glenn Strauss 5 months ago
parent
commit
2ef31a1b3f
  1. 6
      src/chunk.c
  2. 2
      src/http-header-glue.c
  3. 2
      src/mod_webdav.c
  4. 4
      src/mod_wstunnel.c

6
src/chunk.c

@ -375,8 +375,10 @@ static int chunkqueue_append_mem_extend_chunk(chunkqueue * const restrict cq, co
void chunkqueue_append_buffer(chunkqueue * const restrict cq, buffer * const restrict mem) {
chunk *c;
size_t len = mem ? buffer_clen(mem) : 0;
if (len < 1024 && chunkqueue_append_mem_extend_chunk(cq, mem->ptr, len))
return;
if (len < 1024 && chunkqueue_append_mem_extend_chunk(cq, mem->ptr, len)) {
buffer_clear(mem);
return;
}
c = chunkqueue_append_mem_chunk(cq, chunk_buf_sz);
cq->bytes_in += len;

2
src/http-header-glue.c

@ -1173,7 +1173,7 @@ handler_t http_response_read(request_st * const r, http_response_opts * const op
* truncate response or send 500 if nothing sent yet */
return HANDLER_ERROR;
}
buffer_clear(b);
/*buffer_clear(b);*//*http_response_append_buffer() clears*/
}
if (r->conf.stream_response_body & FDEVENT_STREAM_RESPONSE_BUFMIN) {

2
src/mod_webdav.c

@ -629,7 +629,7 @@ webdav_double_buffer (request_st * const r, buffer * const b)
* has not been set, so r->resp_send_chunked can not be set yet */
if (buffer_clen(b) > 60000) {
http_chunk_append_buffer(r, b); /*(might move/steal/reset buffer)*/
buffer_clear(b);
/*buffer_clear(b);*//*http_chunk_append_buffer() clears*/
}
}

4
src/mod_wstunnel.c

@ -977,7 +977,7 @@ static int recv_ietf_00(handler_ctx *hctx) {
&& !buffer_is_unset(payload)) { /*XXX: buffer_is_blank?*/
hctx->frame.ctl.siz = 0;
chunkqueue_append_buffer(&hctx->gw.wb, payload);
buffer_clear(payload);
/*buffer_clear(payload);*//*chunkqueue_append_buffer clear*/
}
else {
if (hctx->frame.state == MOD_WEBSOCKET_FRAME_STATE_INIT
@ -1251,7 +1251,7 @@ static int recv_rfc_6455(handler_ctx *hctx) {
{
unmask_payload(hctx);
chunkqueue_append_buffer(&hctx->gw.wb, payload);
buffer_clear(payload);
/*buffer_clear(payload);*//*chunkqueue_append_buffer clear*/
break;
}
case MOD_WEBSOCKET_FRAME_TYPE_PING:

Loading…
Cancel
Save