Skip to content

ServletWebRequest.isEtagNotModified does not support commas and spaces in client ETags [SPR-14216] #18790

Closed
@spring-projects-issues

Description

@spring-projects-issues

Sebastiaan van Erk opened SPR-14216 and commented

The problem is in isEtagNotModified(String etag):

String[] clientEtags = StringUtils.delimitedListToStringArray(ifNoneMatch, ",", " ");

The client ETags are taken from the ifNoneMatch header and are ETags separated by commas. However the ETags themselves are opaque (double)quoted strings: they may contain commas and/or spaces (and even "). The code above does not take this into account and splits ETags in half if they contain a comma and removes any spaces they may contain.

A workaround is to make sure generated ETags don't have commas or spaces in them (I used the @Version column which is a Date as the ETag where toString() by default generates a space, but I could format it as an ISO8601 timestamp, which contains no spaces or commas).


Affects: 4.2.5

Issue Links:

Referenced from: commits 29da44c

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions