/* Appends the H1 representation of the request line <sl> to the chunk <chk>. It
* returns 1 if data are successfully appended, otherwise it returns 0.
+ * <chk> buffer must not wrap.
*/
int h1_format_htx_reqline(const struct htx_sl *sl, struct buffer *chk)
{
/* Appends the H1 representation of the status line <sl> to the chunk <chk>. It
* returns 1 if data are successfully appended, otherwise it returns 0.
+ * <chk> buffer must not wrap.
*/
int h1_format_htx_stline(const struct htx_sl *sl, struct buffer *chk)
{
/* Appends the H1 representation of the header <n> with the value <v> to the
* chunk <chk>. It returns 1 if data are successfully appended, otherwise it
* returns 0.
+ * <chk> buffer must not wrap.
*/
int h1_format_htx_hdr(const struct ist n, const struct ist v, struct buffer *chk)
{
/* Appends the H1 representation of the data <data> to the chunk <chk>. If
* <chunked> is non-zero, it emits HTTP/1 chunk-encoded data. It returns 1 if
* data are successfully appended, otherwise it returns 0.
+ * <chk> buffer must not wrap.
*/
int h1_format_htx_data(const struct ist data, struct buffer *chk, int chunked)
{
{
struct h1c *h1c = h1s->h1c;
struct htx_blk *blk;
+ struct buffer outbuf;
struct htx_sl *sl;
enum htx_blk_type type;
uint32_t sz;
if (b_space_wraps(&h1c->obuf))
b_slow_realign(&h1c->obuf, trash.area, b_data(&h1c->obuf));
+ outbuf = b_make(b_tail(&h1c->obuf), b_contig_space(&h1c->obuf), 0, 0);
sl = htx_get_blk_ptr(htx, blk);
- if (!h1_format_htx_reqline(sl, &h1c->obuf))
+ if (!h1_format_htx_reqline(sl, &outbuf))
goto full;
+ b_add(&h1c->obuf, outbuf.data);
+
h1s->meth = sl->info.req.meth;
h1_parse_req_vsn(h1m, sl);
{
struct h1c *h1c = h1s->h1c;
struct htx_blk *blk;
+ struct buffer outbuf;
struct htx_sl *sl;
enum htx_blk_type type;
uint32_t sz;
if (b_space_wraps(&h1c->obuf))
b_slow_realign(&h1c->obuf, trash.area, b_data(&h1c->obuf));
+ outbuf = b_make(b_tail(&h1c->obuf), b_contig_space(&h1c->obuf), 0, 0);
sl = htx_get_blk_ptr(htx, blk);
- if (!h1_format_htx_stline(sl, &h1c->obuf))
+ if (!h1_format_htx_stline(sl, &outbuf))
goto full;
+ b_add(&h1c->obuf, outbuf.data);
+
h1s->status = sl->info.res.status;
h1_parse_res_vsn(h1m, sl);