AWS SDK integration added url checking.

This commit is contained in:
Pavel Kovalenko 2019-12-09 13:58:57 +03:00 committed by Pavel Kovalenko
parent 1289966a70
commit 94e9638006
3 changed files with 6 additions and 3 deletions

View File

@ -60,10 +60,12 @@ namespace S3
}
URI::URI(Poco::URI & uri)
URI::URI(Poco::URI & uri_)
{
static const std::regex BUCKET_KEY_PATTERN("([^/]+)/(.*)");
uri = uri_;
// s3://*
if (uri.getScheme() == "s3" || uri.getScheme() == "S3")
{

View File

@ -43,12 +43,13 @@ private:
*/
struct URI
{
Poco::URI uri;
// Custom endpoint if URI scheme is not S3.
String endpoint;
String bucket;
String key;
explicit URI (Poco::URI & uri);
explicit URI (Poco::URI & uri_);
};
}

View File

@ -154,7 +154,7 @@ StorageS3::StorageS3(const S3::URI & uri_,
, compression_method(compression_method_)
, client(S3::ClientFactory::instance().create(uri_.endpoint, access_key_id_, secret_access_key_))
{
context_global.getRemoteHostFilter().checkURL(uri_.endpoint);
context_global.getRemoteHostFilter().checkURL(uri_.uri);
setColumns(columns_);
setConstraints(constraints_);
}