MINOR: htx: Rename functions htx_*_to_str() to be H1 specific

"_to_h1" suffix is now used because these function produce H1 strings. It avoids
any ambiguity on the output format.
This commit is contained in:
Christopher Faulet 2018-12-03 13:58:44 +01:00 committed by Willy Tarreau
parent da7e3be36f
commit c59ff23804
4 changed files with 24 additions and 24 deletions

View File

@ -56,11 +56,11 @@ struct htx_blk *htx_add_trailer(struct htx *htx, const struct ist tlr);
struct htx_blk *htx_add_oob(struct htx *htx, const struct ist oob);
struct htx_blk *htx_add_data_before(struct htx *htx, const struct htx_blk *ref, const struct ist data);
int htx_reqline_to_str(const struct htx_sl *sl, struct buffer *chk);
int htx_stline_to_str(const struct htx_sl *sl, struct buffer *chk);
int htx_hdr_to_str(const struct ist n, const struct ist v, struct buffer *chk);
int htx_data_to_str(const struct ist data, struct buffer *chk, int chunked);
int htx_trailer_to_str(const struct ist tlr, struct buffer *chk);
int htx_reqline_to_h1(const struct htx_sl *sl, struct buffer *chk);
int htx_stline_to_h1(const struct htx_sl *sl, struct buffer *chk);
int htx_hdr_to_h1(const struct ist n, const struct ist v, struct buffer *chk);
int htx_data_to_h1(const struct ist data, struct buffer *chk, int chunked);
int htx_trailer_to_h1(const struct ist tlr, struct buffer *chk);
/* Functions and macros to get parts of the start-line or legnth of these
* parts

View File

@ -628,7 +628,7 @@ static int smp_fetch_hdrs(const struct arg *args, struct sample *smp, const char
struct ist n = htx_get_blk_name(htx, blk);
struct ist v = htx_get_blk_value(htx, blk);
if (!htx_hdr_to_str(n, v, temp))
if (!htx_hdr_to_h1(n, v, temp))
return 0;
}
else if (type == HTX_BLK_EOH) {
@ -856,7 +856,7 @@ static int smp_fetch_body(const struct arg *args, struct sample *smp, const char
if (type == HTX_BLK_EOM || type == HTX_BLK_EOD)
break;
if (type == HTX_BLK_DATA) {
if (!htx_data_to_str(htx_get_blk_value(htx, blk), temp, 0))
if (!htx_data_to_h1(htx_get_blk_value(htx, blk), temp, 0))
return 0;
}
}
@ -2531,7 +2531,7 @@ static int smp_fetch_body_param(const struct arg *args, struct sample *smp, cons
if (type == HTX_BLK_EOM || type == HTX_BLK_EOD)
break;
if (type == HTX_BLK_DATA) {
if (!htx_data_to_str(htx_get_blk_value(htx, blk), temp, 0))
if (!htx_data_to_h1(htx_get_blk_value(htx, blk), temp, 0))
return 0;
}
}

View File

@ -801,11 +801,11 @@ struct htx_blk *htx_add_data_before(struct htx *htx, const struct htx_blk *ref,
return blk;
}
/* Appends the string representation of the request line block <blk> to the
/* Appends the H1 representation of the request line block <blk> to the
* chunk <chk>. It returns 1 if data are successfully appended, otherwise it
* returns 0.
*/
int htx_reqline_to_str(const struct htx_sl *sl, struct buffer *chk)
int htx_reqline_to_h1(const struct htx_sl *sl, struct buffer *chk)
{
if (HTX_SL_LEN(sl) + 4 > b_room(chk))
return 0;
@ -820,11 +820,11 @@ int htx_reqline_to_str(const struct htx_sl *sl, struct buffer *chk)
return 1;
}
/* Appends the string representation of the status line block <blk> to the chunk
/* Appends the H1 representation of the status line block <blk> to the chunk
* <chk>. It returns 1 if data are successfully appended, otherwise it
* returns 0.
*/
int htx_stline_to_str(const struct htx_sl *sl, struct buffer *chk)
int htx_stline_to_h1(const struct htx_sl *sl, struct buffer *chk)
{
if (HTX_SL_LEN(sl) + 4 > b_size(chk))
return 0;
@ -839,11 +839,11 @@ int htx_stline_to_str(const struct htx_sl *sl, struct buffer *chk)
return 1;
}
/* Appends the string representation of the header block <blk> to the chunk
/* Appends the H1 representation of the header block <blk> to the chunk
* <chk>. It returns 1 if data are successfully appended, otherwise it returns
* 0.
*/
int htx_hdr_to_str(const struct ist n, const struct ist v, struct buffer *chk)
int htx_hdr_to_h1(const struct ist n, const struct ist v, struct buffer *chk)
{
if (n.len + v.len + 4 > b_room(chk))
return 0;
@ -856,11 +856,11 @@ int htx_hdr_to_str(const struct ist n, const struct ist v, struct buffer *chk)
return 1;
}
/* Appends the string representation of the data block <blk> to the chunk
/* Appends the H1 representation of the data block <blk> 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.
*/
int htx_data_to_str(const struct ist data, struct buffer *chk, int chunked)
int htx_data_to_h1(const struct ist data, struct buffer *chk, int chunked)
{
if (chunked) {
uint32_t chksz;
@ -890,11 +890,11 @@ int htx_data_to_str(const struct ist data, struct buffer *chk, int chunked)
return 1;
}
/* Appends the string representation of the trailer block <blk> to the chunk
/* Appends the h1 representation of the trailer block <blk> to the chunk
* <chk>. It returns 1 if data are successfully appended, otherwise it returns
* 0.
*/
int htx_trailer_to_str(const struct ist tlr, struct buffer *chk)
int htx_trailer_to_h1(const struct ist tlr, struct buffer *chk)
{
/* FIXME: be sure the CRLF is here or remove it when inserted */
if (!chunk_memcat(chk, tlr.ptr, tlr.len))

View File

@ -1316,7 +1316,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
sl = htx_get_blk_ptr(chn_htx, blk);
h1s->meth = sl->info.req.meth;
h1_parse_req_vsn(h1m, sl);
if (!htx_reqline_to_str(sl, tmp))
if (!htx_reqline_to_h1(sl, tmp))
goto copy;
h1m->flags |= H1_MF_XFER_LEN;
h1m->state = H1_MSG_HDR_FIRST;
@ -1328,7 +1328,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
sl = htx_get_blk_ptr(chn_htx, blk);
h1s->status = sl->info.res.status;
h1_parse_res_vsn(h1m, sl);
if (!htx_stline_to_str(sl, tmp))
if (!htx_stline_to_h1(sl, tmp))
goto copy;
if (sl->flags & HTX_SL_F_XFER_LEN)
h1m->flags |= H1_MF_XFER_LEN;
@ -1353,7 +1353,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
goto skip_hdr;
}
if (!htx_hdr_to_str(n, v, tmp))
if (!htx_hdr_to_h1(n, v, tmp))
goto copy;
skip_hdr:
h1m->state = H1_MSG_HDR_L2_LWS;
@ -1374,7 +1374,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
h1_process_conn_mode(h1s, h1m, NULL, &v);
process_conn_mode = 0;
if (v.len) {
if (!htx_hdr_to_str(n, v, tmp))
if (!htx_hdr_to_h1(n, v, tmp))
goto copy;
}
}
@ -1387,7 +1387,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
case HTX_BLK_DATA:
v = htx_get_blk_value(chn_htx, blk);
if (!htx_data_to_str(v, tmp, !!(h1m->flags & H1_MF_CHNK)))
if (!htx_data_to_h1(v, tmp, !!(h1m->flags & H1_MF_CHNK)))
goto copy;
break;
@ -1405,7 +1405,7 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
h1s->flags |= H1S_F_HAVE_EOD;
}
v = htx_get_blk_value(chn_htx, blk);
if (!htx_trailer_to_str(v, tmp))
if (!htx_trailer_to_h1(v, tmp))
goto copy;
h1s->flags |= H1S_F_HAVE_TLR;
break;