Skip to content

Commit b5c0088

Browse files
committed
Throw error on multiple If-None-Match headers in S3HttpHandler
1 parent 9c860cd commit b5c0088

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/fixtures/s3-fixture/src/main/java/fixture/s3/S3HttpHandler.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,11 +582,17 @@ private static HttpHeaderParser.Range parsePartRange(final HttpExchange exchange
582582
}
583583

584584
private static boolean isProtectOverwrite(final HttpExchange exchange) {
585-
final var ifNoneMatch = exchange.getRequestHeaders().getFirst("If-None-Match");
585+
final var ifNoneMatch = exchange.getRequestHeaders().get("If-None-Match");
586586

587587
if (ifNoneMatch == null) {
588588
return false;
589-
} else if (ifNoneMatch.equals("*")) {
589+
}
590+
591+
if (ifNoneMatch.size() != 1) {
592+
throw new AssertionError("multiple If-None-Match headers found: " + ifNoneMatch);
593+
}
594+
595+
if (ifNoneMatch.getFirst().equals("*")) {
590596
return true;
591597
}
592598

0 commit comments

Comments
 (0)