X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2Fproxy.inc;h=61b20dd1c1b38e3a26190d5d401216387991bc07;hp=d6803db656c15280b98578e85f2621c9b91e43ee;hb=0fa4750d5cfe59f7471f35c9e026af7d771eace8;hpb=5e385d65a67052f3bfdf4efffcde7eedd844e34d diff --git a/tests/proxy.inc b/tests/proxy.inc index d6803db..61b20dd 100644 --- a/tests/proxy.inc +++ b/tests/proxy.inc @@ -1,25 +1,21 @@ getHeader("Proxy-Connection")) { - $response = new http\Env\Response; - $response->send($client); - - /* soak up the request following the connect */ - new http\Message($client, false); - } - - /* return the initial message as response body */ - $response = new http\Env\Response; - $response->getBody()->append($request); - $response->send($client); - } - return; +include "server.inc"; + +serve(function($client) { + /* this might be a proxy connect or a standard request */ + $request = new http\Message($client, false); + + if ($request->getHeader("Proxy-Connection")) { + $response = new http\Env\Response; + $response->send($client); + + /* soak up the request following the connect */ + new http\Message($client, false); } -} \ No newline at end of file + + /* return the initial message as response body */ + $response = new http\Env\Response; + $response->getBody()->append($request); + $response->send($client); +});