diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-07-15 00:32:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 00:32:05 +0300 |
commit | 3e67637a4a7340b0afc37746b03bcd42bbaacda2 (patch) | |
tree | 7dceb06157f79dae6382188e9f5e22f05d64dc93 /lib | |
parent | 5a22b0ac6729079f22342befd75fa9a5265469cf (diff) | |
parent | 388a458cd5bcbafe3c6b589b76a35fed8aeda484 (diff) |
Merge pull request #26463 from Worteks/fix-s3proxy
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConnectionTrait.php | 12 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/S3ObjectTrait.php | 5 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index c72fa48d247..47c20d96d53 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -57,6 +57,9 @@ trait S3ConnectionTrait { /** @var int */ protected $timeout; + /** @var string */ + protected $proxy; + /** @var int */ protected $uploadPartSize; @@ -71,6 +74,7 @@ trait S3ConnectionTrait { $this->test = isset($params['test']); $this->bucket = $params['bucket']; + $this->proxy = isset($params['proxy']) ? $params['proxy'] : false; $this->timeout = !isset($params['timeout']) ? 15 : $params['timeout']; $this->uploadPartSize = !isset($params['uploadPartSize']) ? 524288000 : $params['uploadPartSize']; $params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region']; @@ -86,6 +90,10 @@ trait S3ConnectionTrait { return $this->bucket; } + public function getProxy() { + return $this->proxy; + } + /** * Returns the connection * @@ -123,8 +131,8 @@ trait S3ConnectionTrait { 'csm' => false, 'use_arn_region' => false, ]; - if (isset($this->params['proxy'])) { - $options['request.options'] = ['proxy' => $this->params['proxy']]; + if ($this->getProxy()) { + $options['http'] = [ 'proxy' => $this->getProxy() ]; } if (isset($this->params['legacy_auth']) && $this->params['legacy_auth']) { $options['signature_version'] = 'v2'; diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index b57e4d9846f..bb71306c17d 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -69,6 +69,11 @@ trait S3ObjectTrait { ], ]; + if ($this->getProxy()) { + $opts['http']['proxy'] = $this->getProxy(); + $opts['http']['request_fulluri'] = true; + } + $context = stream_context_create($opts); return fopen($request->getUri(), 'r', false, $context); }); |