Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/private/Files/ObjectStore/S3ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ trait S3ConnectionTrait {
/** @var int */
protected $timeout;

/** @var string */
protected $proxy;

/** @var int */
protected $uploadPartSize;

Expand All @@ -71,6 +74,7 @@ protected function parseParams($params) {

$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'];
Expand All @@ -86,6 +90,10 @@ public function getBucket() {
return $this->bucket;
}

public function getProxy() {
return $this->proxy;
}

/**
* Returns the connection
*
Expand Down Expand Up @@ -122,8 +130,8 @@ public function getConnection() {
'signature_provider' => \Aws\or_chain([self::class, 'legacySignatureProvider'], ClientResolver::_default_signature_provider()),
'csm' => 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';
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Files/ObjectStore/S3ObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public function readObject($urn) {
],
];

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);
});
Expand Down