Browse Source

Merge pull request #26463 from Worteks/fix-s3proxy

tags/v23.0.0beta1
Julius Härtl 2 years ago
parent
commit
3e67637a4a
No account linked to committer's email address

+ 10
- 2
lib/private/Files/ObjectStore/S3ConnectionTrait.php View File

@@ -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';

+ 5
- 0
lib/private/Files/ObjectStore/S3ObjectTrait.php View File

@@ -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);
});

Loading…
Cancel
Save