Improve multi-valued HTTP headers support

Prior to this change, getting header values with `HttpHeaders` when
headers are multi-valued would cause issues.
For example, for a given HTTP message with headers:
    Cache-Control: public, s-maxage=50
    Cache-Control: max-age=42

Getting a `List` of all values would return <"public", "s-maxage=50">
and getting the header value would return "public, s-maxage=50".

This commit takes now into account multi-valued HTTP headers and adds
new getters/setters for "If-Match" and "If-Unmodified-Since" headers.

Note that for ETag-related headers such as "If-Match" and
"If-None-Match", a special parser has been implemented since ETag values
can contain separator characters.

Issue: SPR-14223, SPR-14228
This commit is contained in:
Brian Clozel
2016-04-28 17:59:34 +02:00
parent 15138ed96f
commit 55dae618a6
3 changed files with 189 additions and 33 deletions

View File

@@ -172,7 +172,7 @@ public class WebSocketHttpHeaders extends HttpHeaders {
return Collections.emptyList();
}
else if (values.size() == 1) {
return getFirstValueAsList(SEC_WEBSOCKET_PROTOCOL);
return getValuesAsList(SEC_WEBSOCKET_PROTOCOL);
}
else {
return values;