mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 14:51:27 +02:00
MINOR: buffer: remove bo_contig_data()
The two call places now make use of b_contig_data(0) and check by themselves that the returned size is no larger than the scheduled output data.
This commit is contained in:
parent
8f9c72d301
commit
0e11d59af6
@ -105,16 +105,6 @@ static inline void bo_del(struct buffer *b, unsigned int del)
|
|||||||
b->o -= del;
|
b->o -= del;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the amount of output data that can contiguously be read at once */
|
|
||||||
static inline int bo_contig_data(const struct buffer *b)
|
|
||||||
{
|
|
||||||
char *beg = b->p - b->o;
|
|
||||||
|
|
||||||
if (beg < b->data)
|
|
||||||
return b->data - beg;
|
|
||||||
return b->o;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the amount of bytes that can be written into the input area at once
|
/* Return the amount of bytes that can be written into the input area at once
|
||||||
* including reserved space which may be overwritten (this is the caller
|
* including reserved space which may be overwritten (this is the caller
|
||||||
* responsibility to know if the reserved space is protected or not).
|
* responsibility to know if the reserved space is protected or not).
|
||||||
|
@ -720,7 +720,10 @@ http_compression_buffer_end(struct comp_state *st, struct stream *s,
|
|||||||
|
|
||||||
/* Copy previous data from ib->o into ob->o */
|
/* Copy previous data from ib->o into ob->o */
|
||||||
if (ib->o > 0) {
|
if (ib->o > 0) {
|
||||||
left = bo_contig_data(ib);
|
left = b_contig_data(ib, 0);
|
||||||
|
if (left > ib->o)
|
||||||
|
left = ib->o;
|
||||||
|
|
||||||
memcpy(ob->p - ob->o, b_head(ib), left);
|
memcpy(ob->p - ob->o, b_head(ib), left);
|
||||||
if (ib->o - left) /* second part of the buffer */
|
if (ib->o - left) /* second part of the buffer */
|
||||||
memcpy(ob->p - ob->o + left, ib->data, ib->o - left);
|
memcpy(ob->p - ob->o + left, ib->data, ib->o - left);
|
||||||
|
@ -5526,7 +5526,9 @@ static int ssl_sock_from_buf(struct connection *conn, struct buffer *buf, int fl
|
|||||||
size_t written_data;
|
size_t written_data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try = bo_contig_data(buf);
|
try = b_contig_data(buf, 0);
|
||||||
|
if (try > buf->o)
|
||||||
|
try = buf->o;
|
||||||
|
|
||||||
if (!(flags & CO_SFL_STREAMER) &&
|
if (!(flags & CO_SFL_STREAMER) &&
|
||||||
!(conn->xprt_st & SSL_SOCK_SEND_UNLIMITED) &&
|
!(conn->xprt_st & SSL_SOCK_SEND_UNLIMITED) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user