mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-08 11:14:31 +02:00
[WIP] WebDav Storage backend
This commit is contained in:
parent
13a91e63aa
commit
1c089e8d89
3 changed files with 10 additions and 11 deletions
|
@ -125,6 +125,10 @@ class HTTPClient implements IHTTPClient
|
|||
$conf[RequestOptions::BODY] = $opts[HTTPClientOptions::BODY];
|
||||
}
|
||||
|
||||
if (!empty($opts[HTTPClientOptions::AUTH])) {
|
||||
$conf[RequestOptions::AUTH] = $opts[HTTPClientOptions::AUTH];
|
||||
}
|
||||
|
||||
$conf[RequestOptions::ON_HEADERS] = function (ResponseInterface $response) use ($opts) {
|
||||
if (!empty($opts[HTTPClientOptions::CONTENT_LENGTH]) &&
|
||||
(int)$response->getHeaderLine('Content-Length') > $opts[HTTPClientOptions::CONTENT_LENGTH]) {
|
||||
|
@ -135,17 +139,7 @@ class HTTPClient implements IHTTPClient
|
|||
try {
|
||||
$this->logger->debug('http request config.', ['url' => $url, 'method' => $method, 'options' => $conf]);
|
||||
|
||||
switch ($method) {
|
||||
case 'get':
|
||||
case 'head':
|
||||
case 'post':
|
||||
case 'put':
|
||||
case 'delete':
|
||||
$response = $this->client->$method($url, $conf);
|
||||
break;
|
||||
default:
|
||||
throw new TransferException('Invalid method');
|
||||
}
|
||||
$response = $this->client->request($method, $url, $conf);
|
||||
return new GuzzleResponse($response, $url);
|
||||
} catch (TransferException $exception) {
|
||||
if ($exception instanceof RequestException &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue