From 64b0df073e31afbd490f4b408eb123d27c12ff56 Mon Sep 17 00:00:00 2001 From: Chris McFarlen Date: Fri, 19 Dec 2025 09:56:25 -0600 Subject: [PATCH] Use malloc allocated buffers for h2 headers if enabled --- include/proxy/http2/Http2CommonSession.h | 4 ++++ include/proxy/http2/Http2Stream.h | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/proxy/http2/Http2CommonSession.h b/include/proxy/http2/Http2CommonSession.h index cb61107fe9c..0b1d9b8112b 100644 --- a/include/proxy/http2/Http2CommonSession.h +++ b/include/proxy/http2/Http2CommonSession.h @@ -60,7 +60,11 @@ enum class Http2SsnMilestone { LAST_ENTRY, }; +#if TS_USE_MALLOC_ALLOCATOR +size_t const HTTP2_HEADER_BUFFER_SIZE_INDEX = BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(4096); +#else size_t const HTTP2_HEADER_BUFFER_SIZE_INDEX = BUFFER_SIZE_INDEX_4K; +#endif /** @startuml diff --git a/include/proxy/http2/Http2Stream.h b/include/proxy/http2/Http2Stream.h index f9961e777bf..2ba9f61361e 100644 --- a/include/proxy/http2/Http2Stream.h +++ b/include/proxy/http2/Http2Stream.h @@ -209,10 +209,14 @@ class Http2Stream : public ProxyTransaction Http2StreamState _state = Http2StreamState::HTTP2_STREAM_STATE_IDLE; int64_t _http_sm_id = -1; - HTTPHdr _receive_header; + HTTPHdr _receive_header; +#if TS_USE_MALLOC_ALLOCATOR + MIOBuffer _receive_buffer{BUFFER_SIZE_INDEX_FOR_XMALLOC_SIZE(4096)}; +#else MIOBuffer _receive_buffer{BUFFER_SIZE_INDEX_4K}; - VIO read_vio; - VIO write_vio; +#endif + VIO read_vio; + VIO write_vio; History _history; Milestones(Http2StreamMilestone::LAST_ENTRY)> _milestones;