Skip to content

Commit 92ceb25

Browse files
Merge branch '4.4'
* 4.4: (28 commits) [FrameworkBundle] Fix framework bundle lock configuration not working as expected [Validator] Add the missing translations for the Azerbaijani locale [HttpClient] workaround bad Content-Length sent by old libcurl [Cache] dont override native Memcached options Fix CS Fix exceptions (PDOException) error code type [ErrorHandler] fix return-type patching logic [Messenger] Added support for `from_transport` attribute on `messenger.message_handler` tag [ErrorHandler] don't throw deprecations for return-types by default ensure legacy event dispatcher compatibility ensure legacy event dispatcher compatibility Fix return type of Process::restart(). [Cache] fail gracefully when locking is not supported [HttpKernel] compress files generated by the profiler tweak deprecation messages and changelog fix version in @deprecated annotation Use VarCloner data instead of legacy array for query params [Security] use LegacyEventDispatcherProxy [HttpClient] fix undefined index access [HttpClient] fix race condition when reading response with informational status ...
2 parents 8b90a56 + 76cc56c commit 92ceb25

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

CurlHttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function request(string $method, string $url, array $options = []): Respo
269269
if ('POST' !== $method) {
270270
$curlopts[CURLOPT_UPLOAD] = true;
271271
}
272-
} elseif ('' !== $body) {
272+
} elseif ('' !== $body || 'POST' === $method) {
273273
$curlopts[CURLOPT_POSTFIELDS] = $body;
274274
}
275275

@@ -383,7 +383,7 @@ private static function handlePush($parent, $pushed, array $requestHeaders, Curl
383383
*/
384384
private static function acceptPushForRequest(string $method, array $options, PushedResponse $pushedResponse): bool
385385
{
386-
if ($options['body'] || $method !== $pushedResponse->requestHeaders[':method'][0]) {
386+
if ('' !== $options['body'] || $method !== $pushedResponse->requestHeaders[':method'][0]) {
387387
return false;
388388
}
389389

DataCollector/HttpClientDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private function collectOnClient(TraceableHttpClient $client): array
113113
}
114114

115115
$info = $trace['info'];
116-
$traces[$i]['http_code'] = $info['http_code'];
116+
$traces[$i]['http_code'] = $info['http_code'] ?? 0;
117117

118118
unset($info['filetime'], $info['http_code'], $info['ssl_verify_result'], $info['content_type']);
119119

Response/CurlResponse.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,17 @@ public function __construct(CurlClientState $multi, $ch, array $options = null,
133133

134134
if (\in_array($waitFor, ['headers', 'destruct'], true)) {
135135
try {
136-
self::stream([$response])->current();
136+
foreach (self::stream([$response]) as $chunk) {
137+
if ($chunk->isFirst()) {
138+
break;
139+
}
140+
}
137141
} catch (\Throwable $e) {
138142
// Persist timeouts thrown during initialization
139143
$response->info['error'] = $e->getMessage();
140144
$response->close();
141145
throw $e;
142146
}
143-
} elseif ('content' === $waitFor && ($response->multi->handlesActivity[$response->id][0] ?? null) instanceof FirstChunk) {
144-
self::stream([$response])->current();
145147
}
146148

147149
curl_setopt($ch, CURLOPT_HEADERFUNCTION, null);

Response/NativeResponse.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ public function __construct(NativeClientState $multi, $context, string $url, $op
6767
}
6868

6969
if (null === $response->remaining) {
70-
self::stream([$response])->current();
70+
foreach (self::stream([$response]) as $chunk) {
71+
if ($chunk->isFirst()) {
72+
break;
73+
}
74+
}
7175
}
7276
};
7377
}

0 commit comments

Comments
 (0)