[WIP] WebDav Storage backend

This commit is contained in:
Philipp Holzer 2021-08-25 23:47:18 +02:00
父節點 13a91e63aa
當前提交 1c089e8d89
沒有發現已知的金鑰在資料庫的簽署中
GPG 金鑰 ID: 9A28B7D4FF5667BD
共有 3 個檔案被更改,包括 10 行新增11 行删除

查看文件

@ -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 &&

查看文件

@ -37,4 +37,8 @@ class HTTPClientOptions
* body: (mixed) Setting the body for sending data
*/
const BODY = RequestOptions::BODY;
/**
* auth: (array) Authentication settings for specific requests
*/
const AUTH = RequestOptions::AUTH;
}

查看文件

@ -97,6 +97,7 @@ interface IHTTPClient
* 'cookiejar' => path to cookie jar file
* 'header' => header array
* 'content_length' => int maximum File content length
* 'auth' => array authentication settings
*
* @return IHTTPResult
*/