parse authorization header backwards

this is to accomodate using s3proxy with swift backend, which has
a colon in the access key
pull/54/head
Ka-Hing Cheung 2015-04-28 18:07:03 -07:00
rodzic 8fa555d093
commit abc1bc4910
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -279,13 +279,13 @@ final class S3ProxyHandler extends AbstractHandler {
if (headerAuthorization != null) {
if (headerAuthorization.startsWith("AWS ")) {
String[] values =
headerAuthorization.substring(4).split(":", 2);
if (values.length != 2) {
int colon = headerAuthorization.lastIndexOf(':',
headerAuthorization.length() - 2);
if (colon < 4) {
throw new S3Exception(S3ErrorCode.INVALID_ARGUMENT);
}
requestIdentity = values[0];
requestSignature = values[1];
requestIdentity = headerAuthorization.substring(4, colon);
requestSignature = headerAuthorization.substring(colon + 1);
} else if (headerAuthorization.startsWith("AWS4-HMAC-SHA256 ")) {
// Fail V4 signature requests to allow clients to retry with V2.
throw new S3Exception(S3ErrorCode.INVALID_ARGUMENT);