From: Brad Jorsch Date: Tue, 19 Feb 2019 18:54:03 +0000 (-0500) Subject: MultiHttpClient: Don't relay the end-of-headers line X-Git-Tag: 1.34.0-rc.0~2780^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=8b89f8f37538ba64f9835ee454be21e580495647;p=lhc%2Fweb%2Fwiklou.git MultiHttpClient: Don't relay the end-of-headers line The callback registered by CURLOPT_HEADERFUNCTION is called for the empty line that separates the headers from the body, as well as all the actual headers. In this case, the $header string will be "\r\n". It turns out that HHVM ignores a call to header() when passed a string that's empty after trimming whitespace, while Zend PHP only ignores the call when the string is empty before trimming whitespace. This later causes problems when headers_list() is used expecting all strings returned to contain a colon. Bug: T216086 Change-Id: I07937b17beb06788166266fbb1ea1bbf456761e3 --- diff --git a/includes/libs/MultiHttpClient.php b/includes/libs/MultiHttpClient.php index 6ce8f45f3b..536177edeb 100644 --- a/includes/libs/MultiHttpClient.php +++ b/includes/libs/MultiHttpClient.php @@ -384,7 +384,7 @@ class MultiHttpClient implements LoggerAwareInterface { curl_setopt( $ch, CURLOPT_HEADERFUNCTION, function ( $ch, $header ) use ( &$req ) { - if ( !empty( $req['flags']['relayResponseHeaders'] ) ) { + if ( !empty( $req['flags']['relayResponseHeaders'] ) && trim( $header ) !== '' ) { header( $header ); } $length = strlen( $header );