X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Flibs%2FMultiHttpClient.php;h=7594da2916f94ed8c1a95c6e630df046b91cc65d;hb=228d796b1d6299ccd39418e85f40437292b47dd4;hp=3282ae2054ebe0764f4fbe134e30f4265de04240;hpb=9ba178b8aa3aa93a5bba1d09cfa85527e8edfa8f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/MultiHttpClient.php b/includes/libs/MultiHttpClient.php index 3282ae2054..7594da2916 100644 --- a/includes/libs/MultiHttpClient.php +++ b/includes/libs/MultiHttpClient.php @@ -48,7 +48,7 @@ use Psr\Log\NullLogger; class MultiHttpClient implements LoggerAwareInterface { /** @var resource */ protected $multiHandle = null; // curl_multi handle - /** @var string|null SSL certificates path */ + /** @var string|null SSL certificates path */ protected $caBundlePath; /** @var int */ protected $connTimeout = 10; @@ -346,16 +346,7 @@ class MultiHttpClient implements LoggerAwareInterface { // Don't interpret POST parameters starting with '@' as file uploads, because this // makes it impossible to POST plain values starting with '@' (and causes security // issues potentially exposing the contents of local files). - // The PHP manual says this option was introduced in PHP 5.5 defaults to true in PHP 5.6, - // but we support lower versions, and the option doesn't exist in HHVM 5.6.99. - if ( defined( 'CURLOPT_SAFE_UPLOAD' ) ) { - curl_setopt( $ch, CURLOPT_SAFE_UPLOAD, true ); - } elseif ( is_array( $req['body'] ) ) { - // In PHP 5.2 and later, '@' is interpreted as a file upload if POSTFIELDS - // is an array, but not if it's a string. So convert $req['body'] to a string - // for safety. - $req['body'] = http_build_query( $req['body'] ); - } + curl_setopt( $ch, CURLOPT_SAFE_UPLOAD, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $req['body'] ); } else { if ( is_resource( $req['body'] ) || $req['body'] !== '' ) { @@ -384,7 +375,7 @@ class MultiHttpClient implements LoggerAwareInterface { } $length = strlen( $header ); $matches = []; - if ( preg_match( "/^(HTTP\/1\.[01]) (\d{3}) (.*)/", $header, $matches ) ) { + if ( preg_match( "/^(HTTP\/(?:1\.[01]|2)) (\d{3}) (.*)/", $header, $matches ) ) { $req['response']['code'] = (int)$matches[2]; $req['response']['reason'] = trim( $matches[3] ); return $length;