Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7b03157

Browse filesBrowse files
[HttpClient] fail properly when the server replies with HTTP/0.9
1 parent afd4027 commit 7b03157
Copy full SHA for 7b03157

File tree

2 files changed

+8
-3
lines changed
Filter options

2 files changed

+8
-3
lines changed

‎src/Symfony/Component/HttpClient/Response/CurlResponse.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/Response/CurlResponse.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function __construct(CurlClientState $multi, $ch, array $options = null,
100100
return;
101101
}
102102

103-
$this->inflate = !isset($options['normalized_headers']['accept-encoding']);
103+
$this->inflate = isset($options['normalized_headers']['accept-encoding']) ? false : null;
104104
curl_pause($ch, \CURLPAUSE_CONT);
105105

106106
if ($onProgress = $options['on_progress']) {

‎src/Symfony/Component/HttpClient/Response/ResponseTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/Response/ResponseTrait.php
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ private static function addResponseHeaders(array $responseHeaders, array &$info,
270270
$debug .= "< \r\n";
271271

272272
if (!$info['http_code']) {
273-
throw new TransportException('Invalid or missing HTTP status line.');
273+
throw new TransportException(sprintf('Invalid or missing HTTP status line for "%s".', implode('', $info['url'])));
274274
}
275275
}
276276

@@ -349,8 +349,13 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
349349
$elapsedTimeout = 0;
350350

351351
if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) {
352+
if (null === $response->inflate) {
353+
$multi->handlesActivity[$j] = [null, new TransportException(sprintf('Unsupported protocol for "%s"', $response->getInfo('url')))];
354+
continue;
355+
}
356+
352357
if (null !== $response->inflate && false === $chunk = @inflate_add($response->inflate, $chunk)) {
353-
$multi->handlesActivity[$j] = [null, new TransportException('Error while processing content unencoding.')];
358+
$multi->handlesActivity[$j] = [null, new TransportException(sprintf('Error while processing content unencoding for "%s".', $response->getInfo('url')))];
354359
continue;
355360
}
356361

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.