@@ -11,33 +11,31 @@ require __DIR__.'/../include/bootstrap.php';
11
11
12
12
$ pm = new SwooleTest \ProcessManager ;
13
13
$ pm ->parentFunc = function () use ($ pm ) {
14
- Co \Run (function () use ($ pm ) {
15
- $ cli = new Swoole \Coroutine \Http \Client ('127.0.0.1 ' , $ pm -> getFreePort () );
14
+ Co \run (function () use ($ pm ) {
15
+ $ cli = new Swoole \Coroutine \Http \Client ('127.0.0.1 ' , 1234 );
16
16
$ cli ->set ([
17
17
'timeout ' => 30 ,
18
- 'http_proxy_host ' => HTTP_PROXY_HOST ,
19
- 'http_proxy_port ' => HTTP_PROXY_PORT ,
18
+ 'http_proxy_host ' => ' 127.0.0.1 ' ,
19
+ 'http_proxy_port ' => $ pm -> getFreePort () ,
20
20
]);
21
21
$ cli ->setHeaders ([
22
- 'Host ' => '127.0.0.1: ' . $ pm -> getFreePort () ,
22
+ 'Host ' => '127.0.0.1:1234 ' ,
23
23
]);
24
- $ result = $ cli ->get ('/ ' );
25
- Assert::assert ($ result );
26
- Assert::assert ('Swoole ' === $ cli ->body );
27
- $ cli ->close ();
24
+ $ cli ->get ('/ ' );
28
25
$ pm ->kill ();
29
- echo "DONE \n" ;
30
26
});
31
27
};
32
28
33
29
$ pm ->childFunc = function () use ($ pm ) {
34
- $ server = new Swoole \Http \Server ('0.0.0.0 ' , $ pm ->getFreePort (), SWOOLE_BASE );
35
- $ server ->set (['log_file ' => '/dev/null ' ]);
36
- $ server ->on ('workerStart ' , function () use ($ pm ) {
37
- $ pm ->wakeup ();
38
- });
39
- $ server ->on ('request ' , function (Swoole \Http \Request $ request , Swoole \Http \Response $ response ) use ($ pm ) {
40
- $ response ->end ('Swoole ' );
30
+ $ server = new Swoole \Server ('0.0.0.0 ' , $ pm ->getFreePort (), SWOOLE_BASE );
31
+ $ server ->set ([
32
+ 'log_file ' => '/dev/null ' ,
33
+ 'open_eof_check ' => true ,
34
+ 'package_eof ' => "\r\n\r\n" ,
35
+ ]);
36
+ $ server ->on ('Receive ' , function ($ server , $ fd , $ reactor_id , $ data ) {
37
+ echo $ data ;
38
+ $ server ->close ($ fd );
41
39
});
42
40
$ server ->start ();
43
41
};
@@ -47,4 +45,8 @@ $pm->run();
47
45
48
46
?>
49
47
--EXPECT--
50
- DONE
48
+ GET http://127.0.0.1:1234/ HTTP/1.1
49
+ Host: 127.0.0.1:1234
50
+ Connection: keep-alive
51
+ Accept-Encoding: gzip, deflate
52
+
0 commit comments