return b->data + b->size - b->p;
}
-/* Skips <del> bytes in a one-way buffer <b> : <p> advances by <del>, <i>
- * shrinks by <del> as well, and <o> is left untouched (supposed to be zero).
- * The caller is responsible for ensuring that <del> is always smaller than or
- * equal to b->i.
- */
-static inline void bi_del(struct buffer *b, unsigned int del)
-{
- b->i -= del;
- b->p = b_ptr(b, del);
-}
-
-/* Skips <del> bytes from the output of buffer <b> by simply shrinking <o>.
- * The caller is responsible for ensuring that <del> is always smaller than or
- * equal to b->o.
- */
-static inline void bo_del(struct buffer *b, unsigned int del)
-{
- b->o -= del;
-}
-
/* Return the buffer's length in bytes by summing the input and the output */
static inline int buffer_len(const struct buffer *buf)
{
{
int ret = b_isteq(b, 0, b->i, ist);
if (ret > 0)
- bi_del(b, ret);
+ b_del(b, ret);
return ret;
}
*/
static inline __maybe_unused void h2_skip_frame_hdr(struct buffer *b)
{
- bi_del(b, 9);
+ b_del(b, 9);
}
/* same as above, automatically advances the buffer on success */
ret2 = h2c_snd_settings(h2c);
if (ret2 > 0)
- bi_del(h2c->dbuf, ret1);
+ b_del(h2c->dbuf, ret1);
return ret2;
}
*/
if (unlikely(h2c->last_sid >= 0) && h2c->dsi > h2c->last_sid) {
ret = MIN(h2c->dbuf->i, h2c->dfl);
- bi_del(h2c->dbuf, ret);
+ b_del(h2c->dbuf, ret);
h2c->dfl -= ret;
ret = h2c->dfl == 0;
goto strm_err;
* we reach the end.
*/
ret = MIN(h2c->dbuf->i, h2c->dfl);
- bi_del(h2c->dbuf, ret);
+ b_del(h2c->dbuf, ret);
h2c->dfl -= ret;
ret = h2c->dfl == 0;
}
break;
if (h2c->st0 != H2_CS_FRAME_H) {
- bi_del(h2c->dbuf, h2c->dfl);
+ b_del(h2c->dbuf, h2c->dfl);
h2c->st0 = H2_CS_FRAME_H;
}
}
}
/* now consume the input data */
- bi_del(h2c->dbuf, h2c->dfl);
+ b_del(h2c->dbuf, h2c->dfl);
h2c->st0 = H2_CS_FRAME_H;
buf->i += outlen;
}
/* skip the padlen byte */
- bi_del(h2c->dbuf, 1);
+ b_del(h2c->dbuf, 1);
h2c->dfl--;
h2c->rcvd_c++; h2c->rcvd_s++;
h2c->dff &= ~H2_F_DATA_PADDED;
/* now mark the input data as consumed (will be deleted from the buffer
* by the caller when seeing FRAME_A after sending the window update).
*/
- bi_del(h2c->dbuf, flen);
+ b_del(h2c->dbuf, flen);
h2c->dfl -= flen;
h2c->rcvd_c += flen;
h2c->rcvd_s += flen; // warning, this can also affect the closed streams!
outbuf.str[4] |= H2_F_HEADERS_END_STREAM;
/* consume incoming H1 response */
- bo_del(buf, ret);
+ b_del(buf, ret);
/* commit the H2 response */
h2c->mbuf->o += outbuf.len;
*/
if (es_now) {
// trim any possibly pending data (eg: inconsistent content-length)
- bo_del(buf, buf->o);
+ b_del(buf, buf->o);
h1m->state = HTTP_MSG_DONE;
h2s->flags |= H2_SF_ES_SENT;
h2s_error(h2s, H2_ERR_INTERNAL_ERROR);
goto end;
}
- bo_del(buf, ret);
+ b_del(buf, ret);
total += ret;
h1m->state = HTTP_MSG_CHUNK_SIZE;
}
size = chunk;
h1m->curr_len = chunk;
h1m->body_len += chunk;
- bo_del(buf, ret);
+ b_del(buf, ret);
total += ret;
h1m->state = size ? HTTP_MSG_DATA : HTTP_MSG_TRAILERS;
if (!size)
/* consume incoming H1 response */
if (size > 0) {
- bo_del(buf, size);
+ b_del(buf, size);
total += size;
h1m->curr_len -= size;
h2s->mws -= size;
if (!(h1m->flags & H1_MF_CHNK)) {
// trim any possibly pending data (eg: inconsistent content-length)
- bo_del(buf, buf->o);
+ b_del(buf, buf->o);
h1m->state = HTTP_MSG_DONE;
}
break;
}
total += count;
- bo_del(buf, count);
+ b_del(buf, count);
// trim any possibly pending data (eg: extra CR-LF, ...)
- bo_del(buf, buf->o);
+ b_del(buf, buf->o);
h2s->res.state = HTTP_MSG_DONE;
break;
/* trim any possibly pending data after we close (extra CR-LF,
* unprocessed trailers, abnormal extra data, ...)
*/
- bo_del(buf, buf->o);
+ b_del(buf, buf->o);
}
/* RST are sent similarly to frame acks */