fix: Use vhost name instead of Host header in cache key calculation
What Use vhost name instead of Host header in cache key calculation
Why This change ensures proper cache operation when requests are redirected to different vhosts through HTTP chains. Previously, the cache key was built using uri_path + host (from Host header), which caused incorrect cache behavior when a request with a Host header for one vhost was redirected to a different vhost via HTTP chains. This would lead to storing the cached response under a key that combined the URI with the original Host header, rather than the actual vhost that served the content. With this change, the cache key is now correctly built using uri_path + vhost_name, ensuring that the cache operates properly even when HTTP chains redirect requests between different vhosts. The code falls back to using the Host header when a vhost is not yet assigned.
Links 2366
I also catch kernel warning at the string 2281 (cache.c) if (WARN_ON_ONCE(tot_len != 0))
I also create brunch and add test. We should always write python tests.
[ 1291.938904] Start test: cache.test_cache.TestCacheH2.test_cache_date
[ 1292.566247] [tdb] Start Tempesta DB
[ 1292.642012] [tempesta fw] Initializing Tempesta FW kernel module...
[ 1293.358834] [tempesta fw] Warning: Vhost default doesn't have certificate with matching SAN/CN.
[ 1293.358834] Maybe that's fine, but it's worth checking the
[ 1293.358834] config - if there is no relations between the
[ 1293.358834] names, then host name confusion attack is possible.
[ 1293.533509] [tempesta fw] Configuration processing is completed.
[ 1293.579842] [tdb] Opened table /opt/tempesta/db/filter0.tdb: size=16777216 rec_size=20 base=000000006d0c7901
[ 1293.801164] [tdb] Opened table /opt/tempesta/db/cache0.tdb: size=268435456 rec_size=0 base=000000000019a777
[ 1293.816134] [tdb] Opened table /opt/tempesta/db/sessions0.tdb: size=16777216 rec_size=312 base=00000000cf75e9e4
[ 1293.829874] [tdb] Opened table /opt/tempesta/db/client0.tdb: size=16777216 rec_size=624 base=00000000c10a1b40
[ 1293.897155] [tempesta fw] Open listen socket on: 0.0.0.0:443
[ 1293.899310] [tempesta fw] Open listen socket on: 0.0.0.0
[ 1293.965049] [tempesta fw] Tempesta FW is ready
[ 1294.037212] ==================================================================
[ 1294.038188] BUG: KASAN: wild-memory-access in __hash_calc+0x162/0x190 [tempesta_lib]
[ 1294.039205] Read of size 1 at addr 00746c7561666564 by task swapper/6/0
please build debug kernel with kasan and run python tests (cache, http2_general) with and without tcp segmentation to check that there is no problems.
Please also squash all commits in one and rebase branch on master