]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: htx: Rename functions htx_*_to_str() to be H1 specific
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 3 Dec 2018 12:58:44 +0000 (13:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 4 Dec 2018 04:51:37 +0000 (05:51 +0100)
"_to_h1" suffix is now used because these function produce H1 strings. It avoids
any ambiguity on the output format.

include/proto/htx.h
src/http_fetch.c
src/htx.c
src/mux_h1.c

index f15d9312b617020799763c2e5d0bc11b14ecb72a..e59bb4f48e2ea0809fb5873944ce33db5f9f465a 100644 (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
index 884a32049718c776b6a6e8e947c5e4965c16f5e7..81f6669c92219bc8910cae453f01c1ade304d045 100644 (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;
                                }
                        }
index a57c57d15f9eda8e1ea1364a5f63f0a50308183e..d5285eb6d0a88bdb2423b10ed6dbcd34a4b560d2 100644 (file)
--- a/src/htx.c
+++ b/src/htx.c
@@ -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))
index ae0b54b2148c3c23ba9428e21a4cf08fe5f28805..b01e5d768402f6e8e13fe90ce22c8e4f5b6964fe 100644 (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;