https://reisub.nsupdate.info/git
/
friendica.git
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0aaad3e
)
Revert "Replace IHTTPResult for CurlResult usages"
author
Philipp
<admin@philipp.info>
Sun, 11 Oct 2020 21:26:17 +0000
(23:26 +0200)
committer
Philipp
<admin@philipp.info>
Sun, 11 Oct 2020 21:26:17 +0000
(23:26 +0200)
This reverts commit
97167d7b
src/Model/GServer.php
patch
|
blob
|
history
src/Network/CurlResult.php
patch
|
blob
|
history
src/Network/IHTTPRequest.php
patch
|
blob
|
history
tests/src/Core/InstallerTest.php
patch
|
blob
|
history
diff --git
a/src/Model/GServer.php
b/src/Model/GServer.php
index
ac86ef3
..
323a23f
100644
(file)
--- a/
src/Model/GServer.php
+++ b/
src/Model/GServer.php
@@
-30,7
+30,7
@@
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Module\Register;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Module\Register;
-use Friendica\Network\
IHTTP
Result;
+use Friendica\Network\
Curl
Result;
use Friendica\Protocol\Diaspora;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Protocol\Diaspora;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@@
-630,19
+630,18
@@
class GServer
/**
* Detect server type by using the nodeinfo data
*
/**
* Detect server type by using the nodeinfo data
*
- * @param string $url address of the server
- * @param IHTTPResult $httpResult
- *
+ * @param string $url address of the server
+ * @param CurlResult $curlResult
* @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
* @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- private static function fetchNodeinfo(string $url,
IHTTPResult $http
Result)
+ private static function fetchNodeinfo(string $url,
CurlResult $curl
Result)
{
{
- if (!$
http
Result->isSuccess()) {
+ if (!$
curl
Result->isSuccess()) {
return [];
}
return [];
}
- $nodeinfo = json_decode($
http
Result->getBody(), true);
+ $nodeinfo = json_decode($
curl
Result->getBody(), true);
if (!is_array($nodeinfo) || empty($nodeinfo['links'])) {
return [];
if (!is_array($nodeinfo) || empty($nodeinfo['links'])) {
return [];
diff --git
a/src/Network/CurlResult.php
b/src/Network/CurlResult.php
index
1187e45
..
072ab15
100644
(file)
--- a/
src/Network/CurlResult.php
+++ b/
src/Network/CurlResult.php
@@
-101,7
+101,7
@@
class CurlResult implements IHTTPResult
*
* @param string $url optional URL
*
*
* @param string $url optional URL
*
- * @return
IHTTP
Result a CURL with error response
+ * @return
Curl
Result a CURL with error response
* @throws InternalServerErrorException
*/
public static function createErrorCurl($url = '')
* @throws InternalServerErrorException
*/
public static function createErrorCurl($url = '')
diff --git
a/src/Network/IHTTPRequest.php
b/src/Network/IHTTPRequest.php
index
3f9b7f2
..
3ebcc5d
100644
(file)
--- a/
src/Network/IHTTPRequest.php
+++ b/
src/Network/IHTTPRequest.php
@@
-57,7
+57,7
@@
interface IHTTPRequest
* @param string $accept_content supply Accept: header with 'accept_content' as the value
* @param string $cookiejar Path to cookie jar file
*
* @param string $accept_content supply Accept: header with 'accept_content' as the value
* @param string $cookiejar Path to cookie jar file
*
- * @return
IHTTP
Result With all relevant information, 'body' contains the actual fetched content.
+ * @return
Curl
Result With all relevant information, 'body' contains the actual fetched content.
*/
public function fetchFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '');
*/
public function fetchFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '');
@@
-76,7
+76,7
@@
interface IHTTPRequest
* 'cookiejar' => path to cookie jar file
* 'header' => header array
*
* 'cookiejar' => path to cookie jar file
* 'header' => header array
*
- * @return
IHTTP
Result
+ * @return
Curl
Result
*/
public function get(string $url, bool $binary = false, array $opts = []);
*/
public function get(string $url, bool $binary = false, array $opts = []);
@@
-88,7
+88,7
@@
interface IHTTPRequest
* @param array $headers HTTP headers
* @param int $timeout The timeout in seconds, default system config value or 60 seconds
*
* @param array $headers HTTP headers
* @param int $timeout The timeout in seconds, default system config value or 60 seconds
*
- * @return
IHTTP
Result The content
+ * @return
Curl
Result The content
*/
public function post(string $url, $params, array $headers = [], int $timeout = 0);
*/
public function post(string $url, $params, array $headers = [], int $timeout = 0);
diff --git
a/tests/src/Core/InstallerTest.php
b/tests/src/Core/InstallerTest.php
index
37a754b
..
0087968
100644
(file)
--- a/
tests/src/Core/InstallerTest.php
+++ b/
tests/src/Core/InstallerTest.php
@@
-25,7
+25,7
@@
namespace Friendica\Core;
use Dice\Dice;
use Friendica\Core\Config\Cache;
use Friendica\DI;
use Dice\Dice;
use Friendica\Core\Config\Cache;
use Friendica\DI;
-use Friendica\Network\
IHTTP
Result;
+use Friendica\Network\
Curl
Result;
use Friendica\Network\IHTTPRequest;
use Friendica\Test\MockedTest;
use Friendica\Test\Util\VFSTrait;
use Friendica\Network\IHTTPRequest;
use Friendica\Test\MockedTest;
use Friendica\Test\Util\VFSTrait;
@@
-297,14
+297,14
@@
class InstallerTest extends MockedTest
$this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
// Mocking the CURL Response
$this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
// Mocking the CURL Response
- $
IHTTPResult = \Mockery::mock(IHTTP
Result::class);
- $
IHTTP
Result
+ $
curlResult = \Mockery::mock(Curl
Result::class);
+ $
curl
Result
->shouldReceive('getReturnCode')
->andReturn('404');
->shouldReceive('getReturnCode')
->andReturn('404');
- $
IHTTP
Result
+ $
curl
Result
->shouldReceive('getRedirectUrl')
->andReturn('');
->shouldReceive('getRedirectUrl')
->andReturn('');
- $
IHTTP
Result
+ $
curl
Result
->shouldReceive('getError')
->andReturn('test Error');
->shouldReceive('getError')
->andReturn('test Error');
@@
-313,11
+313,11
@@
class InstallerTest extends MockedTest
$networkMock
->shouldReceive('fetchFull')
->with('https://test/install/testrewrite')
$networkMock
->shouldReceive('fetchFull')
->with('https://test/install/testrewrite')
- ->andReturn($
IHTTP
Result);
+ ->andReturn($
curl
Result);
$networkMock
->shouldReceive('fetchFull')
->with('http://test/install/testrewrite')
$networkMock
->shouldReceive('fetchFull')
->with('http://test/install/testrewrite')
- ->andReturn($
IHTTP
Result);
+ ->andReturn($
curl
Result);
$this->dice->shouldReceive('create')
->with(IHTTPRequest::class)
$this->dice->shouldReceive('create')
->with(IHTTPRequest::class)
@@
-344,14
+344,14
@@
class InstallerTest extends MockedTest
$this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
// Mocking the failed CURL Response
$this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
// Mocking the failed CURL Response
- $
IHTTPResultF = \Mockery::mock(IHTTP
Result::class);
- $
IHTTP
ResultF
+ $
curlResultF = \Mockery::mock(Curl
Result::class);
+ $
curl
ResultF
->shouldReceive('getReturnCode')
->andReturn('404');
// Mocking the working CURL Response
->shouldReceive('getReturnCode')
->andReturn('404');
// Mocking the working CURL Response
- $
IHTTPResultW = \Mockery::mock(IHTTP
Result::class);
- $
IHTTP
ResultW
+ $
curlResultW = \Mockery::mock(Curl
Result::class);
+ $
curl
ResultW
->shouldReceive('getReturnCode')
->andReturn('204');
->shouldReceive('getReturnCode')
->andReturn('204');
@@
-360,11
+360,11
@@
class InstallerTest extends MockedTest
$networkMock
->shouldReceive('fetchFull')
->with('https://test/install/testrewrite')
$networkMock
->shouldReceive('fetchFull')
->with('https://test/install/testrewrite')
- ->andReturn($
IHTTP
ResultF);
+ ->andReturn($
curl
ResultF);
$networkMock
->shouldReceive('fetchFull')
->with('http://test/install/testrewrite')
$networkMock
->shouldReceive('fetchFull')
->with('http://test/install/testrewrite')
- ->andReturn($
IHTTP
ResultW);
+ ->andReturn($
curl
ResultW);
$this->dice->shouldReceive('create')
->with(IHTTPRequest::class)
$this->dice->shouldReceive('create')
->with(IHTTPRequest::class)