/** @var float */
protected $connTimeout = 10;
/** @var float */
- protected $reqTimeout = 300;
+ protected $reqTimeout = 900;
/** @var bool */
protected $usePipelining = false;
/** @var int */
* 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)
*
* @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)
+ * @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
+ * @suppress PhanTypeInvalidDimOffset
*/
private function runMultiCurl( array $reqs, array $opts = [] ) {
$chm = $this->getCurlMulti();
* - reqTimeout : default request timeout
* @return resource
* @throws Exception
+ * @suppress PhanTypeMismatchArgumentInternal
*/
protected function getCurlHandle( array &$req, array $opts = [] ) {
$ch = curl_init();
}
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' ) {
'error' => '',
];
- if ( !$sv->isOk() ) {
+ if ( !$sv->isOK() ) {
$svErrors = $sv->getErrors();
if ( isset( $svErrors[0] ) ) {
$req['response']['error'] = $svErrors[0]['message'];
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 {
/**
* 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 ) {