commit cd5254fec4e3b20d2c2ea3bc8be7cadbf1790f10
parent 463c9bd45f5a8c8864a799a9bfc6770ffb3c8155
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Sun, 16 Aug 2026 08:25:24 +0200
add Vary headers to SPA responses
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/mhd/mhd2_spa.c b/src/mhd/mhd2_spa.c
@@ -252,6 +252,15 @@ build_webui (void *cls,
MHD_response_add_header (zresponse,
MHD_HTTP_HEADER_CONTENT_TYPE,
mime));
+ /* Which representation we return depends on the
+ Accept-Encoding header of the client, so shared caches
+ must not serve one variant to a client that asked for
+ another. */
+ if (NULL != zresponse)
+ GNUNET_break (MHD_SC_OK ==
+ MHD_response_add_header (zresponse,
+ MHD_HTTP_HEADER_VARY,
+ MHD_HTTP_HEADER_ACCEPT_ENCODING));
}
}
else
@@ -282,6 +291,10 @@ build_webui (void *cls,
MHD_response_add_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
mime));
+ GNUNET_break (MHD_SC_OK ==
+ MHD_response_add_header (response,
+ MHD_HTTP_HEADER_VARY,
+ MHD_HTTP_HEADER_ACCEPT_ENCODING));
{
struct WebuiFile *w;
diff --git a/src/mhd/mhd_spa.c b/src/mhd/mhd_spa.c
@@ -258,6 +258,13 @@ build_webui (void *cls,
MHD_HTTP_HEADER_CONTENT_TYPE,
mime));
}
+ /* Which representation we return depends on the Accept-Encoding
+ header of the client, so shared caches must not serve one
+ variant to a client that asked for another. */
+ GNUNET_break (MHD_YES ==
+ MHD_add_response_header (response,
+ MHD_HTTP_HEADER_VARY,
+ MHD_HTTP_HEADER_ACCEPT_ENCODING));
{
struct WebuiFile *w;