From: Paladox Date: Sun, 1 Dec 2019 17:59:17 +0000 (+0000) Subject: Fix support for HTTP/2 in MultiHttpClient X-Git-Tag: 1.34.0~15 X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=90c137152d718c6ad88680286229dbbf2a4a75c8 Fix support for HTTP/2 in MultiHttpClient Under buster, curl uses HTTP/2 (confirmed when running eval): Buster: GET xxx HTTP/2 Stretch: GET xxx HTTP/1.1 The code presumes that it will always be HTTP/1.x. We fix this by adjusting the regex to match HTTP2. Bug: T232866 Change-Id: Ibde6036048d5939508df143ec5956abcd0718ad1 --- diff --git a/includes/libs/http/MultiHttpClient.php b/includes/libs/http/MultiHttpClient.php index b195a085ef..b0c8a8b438 100644 --- a/includes/libs/http/MultiHttpClient.php +++ b/includes/libs/http/MultiHttpClient.php @@ -385,7 +385,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;