dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "filebackend: improve internal use of FileBackend constants"
[lhc/web/wiklou.git]
/
includes
/
libs
/
http
/
MultiHttpClient.php
diff --git
a/includes/libs/http/MultiHttpClient.php
b/includes/libs/http/MultiHttpClient.php
index
2e418b9
..
2e3aa70
100644
(file)
--- a/
includes/libs/http/MultiHttpClient.php
+++ b/
includes/libs/http/MultiHttpClient.php
@@
-150,7
+150,7
@@
class MultiHttpClient implements LoggerAwareInterface {
* This is true for the request headers and the response headers. Integer-indexed
* method/URL entries will also be changed to use the corresponding string keys.
*
* This is true for the request headers and the response headers. Integer-indexed
* method/URL entries will also be changed to use the corresponding string keys.
*
- * @param array $reqs Map of HTTP request arrays
+ * @param array
[]
$reqs Map of HTTP request arrays
* @param array $opts
* - connTimeout : connection timeout per request (seconds)
* - reqTimeout : post-connection timeout per request (seconds)
* @param array $opts
* - connTimeout : connection timeout per request (seconds)
* - reqTimeout : post-connection timeout per request (seconds)
@@
-182,14
+182,18
@@
class MultiHttpClient implements LoggerAwareInterface {
*
* @see MultiHttpClient::runMulti()
*
*
* @see MultiHttpClient::runMulti()
*
- * @param array $reqs Map of HTTP request arrays
+ * @param array
[]
$reqs Map of HTTP request arrays
* @param array $opts
* - connTimeout : connection timeout per request (seconds)
* - reqTimeout : post-connection timeout per request (seconds)
* - usePipelining : whether to use HTTP pipelining if possible
* - maxConnsPerHost : maximum number of concurrent connections (per host)
* @param array $opts
* - connTimeout : connection timeout per request (seconds)
* - reqTimeout : post-connection timeout per request (seconds)
* - usePipelining : whether to use HTTP pipelining if possible
* - maxConnsPerHost : maximum number of concurrent connections (per host)
+ * @codingStandardsIgnoreStart
+ * @phan-param array{connTimeout?:int,reqTimeout?:int,usePipelining?:bool,maxConnsPerHost?:int} $opts
+ * @codingStandardsIgnoreEnd
* @return array $reqs With response array populated for each
* @throws Exception
* @return array $reqs With response array populated for each
* @throws Exception
+ * @suppress PhanTypeInvalidDimOffset
*/
private function runMultiCurl( array $reqs, array $opts = [] ) {
$chm = $this->getCurlMulti();
*/
private function runMultiCurl( array $reqs, array $opts = [] ) {
$chm = $this->getCurlMulti();
@@
-293,6
+297,7
@@
class MultiHttpClient implements LoggerAwareInterface {
* - reqTimeout : default request timeout
* @return resource
* @throws Exception
* - reqTimeout : default request timeout
* @return resource
* @throws Exception
+ * @suppress PhanTypeMismatchArgumentInternal
*/
protected function getCurlHandle( array &$req, array $opts = [] ) {
$ch = curl_init();
*/
protected function getCurlHandle( array &$req, array $opts = [] ) {
$ch = curl_init();
@@
-348,9
+353,7
@@
class MultiHttpClient implements LoggerAwareInterface {
}
curl_setopt( $ch, CURLOPT_READFUNCTION,
function ( $ch, $fd, $length ) {
}
curl_setopt( $ch, CURLOPT_READFUNCTION,
function ( $ch, $fd, $length ) {
- $data = fread( $fd, $length );
- $len = strlen( $data );
- return $data;
+ return (string)fread( $fd, $length );
}
);
} elseif ( $req['method'] === 'POST' ) {
}
);
} elseif ( $req['method'] === 'POST' ) {
@@
-498,7
+501,7
@@
class MultiHttpClient implements LoggerAwareInterface {
'error' => '',
];
'error' => '',
];
- if ( !$sv->isO
k
() ) {
+ if ( !$sv->isO
K
() ) {
$svErrors = $sv->getErrors();
if ( isset( $svErrors[0] ) ) {
$req['response']['error'] = $svErrors[0]['message'];
$svErrors = $sv->getErrors();
if ( isset( $svErrors[0] ) ) {
$req['response']['error'] = $svErrors[0]['message'];
@@
-507,6
+510,7
@@
class MultiHttpClient implements LoggerAwareInterface {
if ( isset( $svErrors[0]['params'][0] ) ) {
if ( is_numeric( $svErrors[0]['params'][0] ) ) {
if ( isset( $svErrors[0]['params'][1] ) ) {
if ( isset( $svErrors[0]['params'][0] ) ) {
if ( is_numeric( $svErrors[0]['params'][0] ) ) {
if ( isset( $svErrors[0]['params'][1] ) ) {
+ // @phan-suppress-next-line PhanTypeInvalidDimOffset
$req['response']['reason'] = $svErrors[0]['params'][1];
}
} else {
$req['response']['reason'] = $svErrors[0]['params'][1];
}
} else {
@@
-529,7
+533,7
@@
class MultiHttpClient implements LoggerAwareInterface {
/**
* Normalize request information
*
/**
* Normalize request information
*
- * @param array $reqs the requests to normalize
+ * @param array
[]
$reqs the requests to normalize
*/
private function normalizeRequests( array &$reqs ) {
foreach ( $reqs as &$req ) {
*/
private function normalizeRequests( array &$reqs ) {
foreach ( $reqs as &$req ) {