]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: h1: remove unused function h1_measure_trailers()
authorWilly Tarreau <w@1wt.eu>
Wed, 31 Jan 2024 14:21:06 +0000 (15:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 31 Jan 2024 14:22:12 +0000 (15:22 +0100)
This one stopped being used in 2.1 when HTX became mandatory,
let's drop it.

include/haproxy/h1.h
src/h1.c

index 7152c6ed82e7d4d2415bd2ab24003ef8973f79dd..0eb039523a06b76df9d9f67dabd0a271ee6f5326 100644 (file)
@@ -153,7 +153,6 @@ union h1_sl {                          /* useful start line pointers, relative t
 int h1_headers_to_hdr_list(char *start, const char *stop,
                            struct http_hdr *hdr, unsigned int hdr_num,
                            struct h1m *h1m, union h1_sl *slp);
-int h1_measure_trailers(const struct buffer *buf, unsigned int ofs, unsigned int max);
 
 int h1_parse_cont_len_header(struct h1m *h1m, struct ist *value);
 int h1_parse_xfer_enc_header(struct h1m *h1m, struct ist value);
index e251e74bcad932790f243a15da190cd633ed77b4..dab638787a917322381b7c7fc5025ffaff3bfe23 100644 (file)
--- a/src/h1.c
+++ b/src/h1.c
@@ -1227,57 +1227,6 @@ int h1_headers_to_hdr_list(char *start, const char *stop,
        goto try_again;
 }
 
-/* This function performs a very minimal parsing of the trailers block present
- * at offset <ofs> in <buf> for up to <max> bytes, and returns the number of
- * bytes to delete to skip the trailers. It may return 0 if it's missing some
- * input data, or < 0 in case of parse error (in which case the caller may have
- * to decide how to proceed, possibly eating everything).
- */
-int h1_measure_trailers(const struct buffer *buf, unsigned int ofs, unsigned int max)
-{
-       const char *stop = b_peek(buf, ofs + max);
-       int count = ofs;
-
-       while (1) {
-               const char *p1 = NULL, *p2 = NULL;
-               const char *start = b_peek(buf, count);
-               const char *ptr   = start;
-
-               /* scan current line and stop at LF or CRLF */
-               while (1) {
-                       if (ptr == stop)
-                               return 0;
-
-                       if (*ptr == '\n') {
-                               if (!p1)
-                                       p1 = ptr;
-                               p2 = ptr;
-                               break;
-                       }
-
-                       if (*ptr == '\r') {
-                               if (p1)
-                                       return -1;
-                               p1 = ptr;
-                       }
-
-                       ptr = b_next(buf, ptr);
-               }
-
-               /* after LF; point to beginning of next line */
-               p2 = b_next(buf, p2);
-               count += b_dist(buf, start, p2);
-
-               /* LF/CRLF at beginning of line => end of trailers at p2.
-                * Everything was scheduled for forwarding, there's nothing left
-                * from this message. */
-               if (p1 == start)
-                       break;
-               /* OK, next line then */
-       }
-       return count - ofs;
-}
-
 /* Generate a random key for a WebSocket Handshake in respect with rfc6455
  * The key is 128-bits long encoded as a base64 string in <key_out> parameter
  * (25 bytes long).