Handle invalid Content-Length during create bucket

References #5.
pull/28/head
Andrew Gaul 2014-12-03 18:36:15 -08:00
rodzic 3b2bd615a0
commit 40c4d099d9
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -438,6 +438,22 @@ final class S3ProxyHandler extends AbstractHandler {
options.publicRead();
}
String contentLengthString = request.getHeader(
HttpHeaders.CONTENT_LENGTH);
if (contentLengthString != null) {
long contentLength;
try {
contentLength = Long.parseLong(contentLengthString);
} catch (NumberFormatException nfe) {
sendSimpleErrorResponse(response, S3ErrorCode.INVALID_ARGUMENT);
return;
}
if (contentLength < 0) {
sendSimpleErrorResponse(response, S3ErrorCode.INVALID_ARGUMENT);
return;
}
}
try {
if (blobStore.createContainerInLocation(location, containerName,
options)) {