From: Willy Tarreau Date: Mon, 16 Nov 2026 09:02:53 +0000 (+0100) Subject: DEV: sse-latency: add a parameter after the content-type X-Git-Tag: v3.5-dev13~67 X-Git-Url: https://git.kaiwu.me/web/%22data:,/doc/static/%7B@url%7D?a=commitdiff_plain;h=64050a8b69a81243c509961a3c901191dac1290f;p=haproxy.git DEV: sse-latency: add a parameter after the content-type As reported in GH issue #3574, we're currently using an exact match for text/event-stream, and it fails to match when a parameter is appended. Let's add one here to trigger this problem. Without the parameter: === gateway overhead (gateway minus loopback; negative = loopback noise) === emit->recv (1st token) mean +0.046ms p50 +0.046ms p95 +0.046ms p99 +0.046ms emit->recv (tokens) mean +0.214ms p50 +0.234ms p95 +0.305ms p99 +0.322ms TTFT (client) mean +0.493ms p50 +0.493ms p95 +0.493ms p99 +0.493ms inter-token (client) mean -0.001ms p50 +0.230ms p95 +0.283ms p99 +0.299ms With the parameter: === gateway overhead (gateway minus loopback; negative = loopback noise) === emit->recv (1st token) mean +214.379ms p50 +214.379ms p95 +214.379ms p99 +214.379ms emit->recv (tokens) mean +303.484ms p50 +307.784ms p95 +405.797ms p99 +413.876ms TTFT (client) mean +214.775ms p50 +214.775ms p95 +214.775ms p99 +214.775ms inter-token (client) mean -0.026ms p50 -1.069ms p95 -1.260ms p99 -1.271ms Let's backport this to 3.4 since sse-latency was backported there, and to any version containing a backport of 345aa2b73 ("DEV: sse-latency: add a latency measuring tool for SSE response streams") --- diff --git a/dev/sse-latency/sse-latency.c b/dev/sse-latency/sse-latency.c index 9e760a280..cfa13eb87 100644 --- a/dev/sse-latency/sse-latency.c +++ b/dev/sse-latency/sse-latency.c @@ -817,7 +817,7 @@ static int server_process_request(struct conn *c) /* response head + role chunk */ hl = snprintf(head, sizeof(head), "HTTP/1.1 200 OK\r\n" - "Content-Type: text/event-stream\r\n" + "Content-Type: text/event-stream; charset=utf-8\r\n" "Cache-Control: no-cache\r\n" "Connection: close\r\n" "X-Accel-Buffering: no\r\n"