Skip to content

Commit f0325b0

Browse files
bug #34554 [HttpClient] Fix early cleanup of pushed HTTP/2 responses (lyrixx)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Fix early cleanup of pushed HTTP/2 responses | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- 0f51da6ec7 [HttpClient] Fix early cleanup of pushed HTTP/2 responses
1 parent 88d3fc9 commit f0325b0

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

HttpClient/Test/Fixtures/web/index.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,27 @@
145145
header('Content-Encoding: gzip');
146146
echo str_repeat('-', 1000);
147147
exit;
148+
149+
case '/json':
150+
header("Content-Type: application/json");
151+
echo json_encode([
152+
'documents' => [
153+
['id' => '/json/1'],
154+
['id' => '/json/2'],
155+
['id' => '/json/3'],
156+
],
157+
]);
158+
exit;
159+
160+
case '/json/1':
161+
case '/json/2':
162+
case '/json/3':
163+
header("Content-Type: application/json");
164+
echo json_encode([
165+
'title' => $vars['REQUEST_URI'],
166+
]);
167+
168+
exit;
148169
}
149170

150171
header('Content-Type: application/json', true);

HttpClient/Test/HttpClientTestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
*/
2525
abstract class HttpClientTestCase extends TestCase
2626
{
27-
private static $server;
28-
2927
public static function setUpBeforeClass(): void
3028
{
3129
TestHttpServer::start();

HttpClient/Test/TestHttpServer.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,22 @@
1919
*/
2020
class TestHttpServer
2121
{
22-
private static $server;
22+
private static $started;
2323

2424
public static function start()
2525
{
26-
if (null !== self::$server) {
26+
if (self::$started) {
2727
return;
2828
}
2929

3030
$finder = new PhpExecutableFinder();
3131
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
3232
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
33-
$process->setTimeout(300);
3433
$process->start();
3534

36-
self::$server = new class() {
37-
public $process;
38-
39-
public function __destruct()
40-
{
41-
$this->process->stop();
42-
}
43-
};
44-
45-
self::$server->process = $process;
46-
35+
register_shutdown_function([$process, 'stop']);
4736
sleep('\\' === \DIRECTORY_SEPARATOR ? 10 : 1);
37+
38+
self::$started = true;
4839
}
4940
}

0 commit comments

Comments
 (0)