commit 32531d99f47b6b390c1804a2a7d58d5fc2c6d9ae
parent ea40014ff62602b0c2c3264d7d42723bbc1b0303
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 11 Oct 2026 14:17:42 +0200
limit 304 to conditional requests as per RFC 9110
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/exchange/taler-exchange-httpd_get-coins-COIN_PUB-history.c b/src/exchange/taler-exchange-httpd_get-coins-COIN_PUB-history.c
@@ -599,6 +599,7 @@ TEH_handler_coins_get (struct TEH_RequestContext *rc,
uint64_t start_off = 0;
uint64_t etag_in;
uint64_t etag_out;
+ bool have_etag = false;
char etagp[24];
struct MHD_Response *resp;
unsigned int http_status;
@@ -655,6 +656,7 @@ TEH_handler_coins_get (struct TEH_RequestContext *rc,
else
{
etag_in = (uint64_t) ev;
+ have_etag = true;
}
}
else
@@ -704,7 +706,9 @@ TEH_handler_coins_get (struct TEH_RequestContext *rc,
sizeof (etagp),
"\"%llu\"",
(unsigned long long) etag_out);
- if (etag_in == etag_out)
+ /* RFC 9110, Section 15.4.5: only answer 304 to a conditional request */
+ if (have_etag &&
+ (etag_in == etag_out))
{
return TEH_RESPONSE_reply_not_modified (rc->connection,
etagp,