kopia lustrzana https://github.com/gaul/s3proxy
Check supported headers before signature
This gives better errors. Also use case-insensitive comparisons.pull/808/head
rodzic
8417af1f6e
commit
73e5f3da1d
|
@ -476,6 +476,34 @@ public class S3ProxyHandler {
|
|||
path[i] = URLDecoder.decode(path[i], StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
for (String parameter : Collections.list(
|
||||
request.getParameterNames())) {
|
||||
if (UNSUPPORTED_PARAMETERS.contains(parameter)) {
|
||||
logger.error("Unknown parameters {} with URI {}",
|
||||
parameter, request.getRequestURI());
|
||||
throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
// emit NotImplemented for unknown x-amz- headers
|
||||
for (String headerName : Collections.list(request.getHeaderNames())) {
|
||||
headerName = headerName.toLowerCase();
|
||||
if (ignoreUnknownHeaders) {
|
||||
continue;
|
||||
}
|
||||
if (!headerName.startsWith("x-amz-")) {
|
||||
continue;
|
||||
}
|
||||
if (headerName.startsWith(USER_METADATA_PREFIX)) {
|
||||
continue;
|
||||
}
|
||||
if (!SUPPORTED_X_AMZ_HEADERS.contains(headerName)) {
|
||||
logger.error("Unknown header {} with URI {}",
|
||||
headerName, request.getRequestURI());
|
||||
throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
Map.Entry<String, BlobStore> provider =
|
||||
blobStoreLocator.locateBlobStore(
|
||||
requestIdentity, path.length > 1 ? path[1] : null,
|
||||
|
@ -620,33 +648,6 @@ public class S3ProxyHandler {
|
|||
}
|
||||
}
|
||||
|
||||
for (String parameter : Collections.list(
|
||||
request.getParameterNames())) {
|
||||
if (UNSUPPORTED_PARAMETERS.contains(parameter)) {
|
||||
logger.error("Unknown parameters {} with URI {}",
|
||||
parameter, request.getRequestURI());
|
||||
throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
// emit NotImplemented for unknown x-amz- headers
|
||||
for (String headerName : Collections.list(request.getHeaderNames())) {
|
||||
if (ignoreUnknownHeaders) {
|
||||
continue;
|
||||
}
|
||||
if (!headerName.startsWith("x-amz-")) {
|
||||
continue;
|
||||
}
|
||||
if (headerName.startsWith(USER_METADATA_PREFIX)) {
|
||||
continue;
|
||||
}
|
||||
if (!SUPPORTED_X_AMZ_HEADERS.contains(headerName.toLowerCase())) {
|
||||
logger.error("Unknown header {} with URI {}",
|
||||
headerName, request.getRequestURI());
|
||||
throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate container name
|
||||
if (!uri.equals("/") && !isValidContainer(path[1])) {
|
||||
if (method.equals("PUT") &&
|
||||
|
|
Ładowanie…
Reference in New Issue