]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: htx: Add a function to retrieve the HTTP version from a start-line
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 25 Feb 2026 14:33:37 +0000 (15:33 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 5 Mar 2026 14:34:46 +0000 (15:34 +0100)
htx_sl_vsn() function can now be used to retrieve the ist string
representing the HTTP version from a start-line passed as parameter. This
function takes care to return the right part of the start-line, depending on
its type (request or response).

include/haproxy/htx.h

index 84a5200c9c2562d2a026bc952f5ebdf47a573d3b..6a905a731aca94a501b36d05f699ffd9081cff25 100644 (file)
@@ -98,6 +98,11 @@ static inline struct ist htx_sl_p3(const struct htx_sl *sl)
        return ist2(HTX_SL_P3_PTR(sl), HTX_SL_P3_LEN(sl));
 }
 
+static inline struct ist htx_sl_vsn(const struct htx_sl *sl)
+{
+       return ((sl->flags & HTX_SL_F_IS_RESP) ? htx_sl_p1(sl) : htx_sl_p3(sl));
+}
+
 static inline struct ist htx_sl_req_meth(const struct htx_sl *sl)
 {
        return htx_sl_p1(sl);