Skip to content

Recognize SSE fields without a colon in ServerSentEventHttpMessageReader - #37464

Open
lejuho wants to merge 1 commit into
spring-projects:mainfrom
lejuho:sse-data-field-without-colon
Open

lejuho wants to merge 1 commit into
spring-projects:mainfrom
lejuho:sse-data-field-without-colon

Conversation

@lejuho

@lejuho lejuho commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Overview

Fixes #37461.

ServerSentEventHttpMessageReader only recognized SSE field lines that contain a colon (data:, id:, event:, retry:). Per the WHATWG HTML Living Standard, a line without a colon is a field name with an empty value, so data and data: (and likewise for id, event, and retry) must be treated equivalently.

Changes

  • Treat bare data, id, event, and retry lines as the corresponding field with an empty value.
  • Empty retry without a colon is ignored, consistent with the existing invalid-retry handling.

Testing

./gradlew :spring-web:test --tests org.springframework.http.codec.ServerSentEventHttpMessageReaderTests
./gradlew :spring-web:checkstyleMain :spring-web:checkstyleTest

Result: BUILD SUCCESSFUL (15 tests, 0 failures; Checkstyle passes).

Per the WHATWG HTML Living Standard, a line without a colon is a field
name with an empty value. Treat bare "data", "id", "event", and "retry"
the same as the colon form with an empty value.

Fixes spring-projectsgh-37461

Signed-off-by: lejuho <zedd1324@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 13, 2026
@sbrannen sbrannen added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Oct 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web Issues in web modules (web, webmvc, webflux, websocket) status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ServerSentEventHttpMessageReader does not recognize data fields without a colon

3 participants