Fix server errors for invalid If-None-Match request headers

HttpEntityMethodProcessor should not throw IllegalArgumentExceptions for
invalid If-None-Match headers.

For those cases, this commit makes sure that both
`HttpEntityMethodProcessor` and `ServletWebRequest` have a consistent
behavior and stop processing the request as conditional and leave the
handler handle it.

Issue: SPR-14559
This commit is contained in:
Brian Clozel
2016-08-26 15:33:02 +02:00
parent 5998a297ce
commit d8fc13f6fc
3 changed files with 44 additions and 16 deletions

View File

@@ -99,6 +99,15 @@ public class ServletWebRequestHttpMethodsTests {
assertEquals(dateFormat.format(epochTime), servletResponse.getHeader("Last-Modified"));
}
@Test // SPR-14559
public void checkNotModifiedInvalidIfNoneMatchHeader() {
String eTag = "\"etagvalue\"";
servletRequest.addHeader("If-None-Match", "missingquotes");
assertFalse(request.checkNotModified(eTag));
assertEquals(200, servletResponse.getStatus());
assertEquals(eTag, servletResponse.getHeader("ETag"));
}
@Test
public void checkNotModifiedHeaderAlreadySet() {
long epochTime = currentDate.getTime();