Merge branch 'master' into phpng
[m6w6/ext-http] / tests / helper / proxy.inc
1 <?php
2
3 include "server.inc";
4
5 serve(function($client) {
6 /* this might be a proxy connect or a standard request */
7 $request = new http\Message($client, false);
8
9 if ($request->getHeader("Proxy-Connection")) {
10 $response = new http\Env\Response;
11 $response->setEnvRequest($request);
12 $response->send($client);
13
14 /* soak up the request following the connect */
15 new http\Message($client, false);
16 }
17
18 /* return the initial message as response body */
19 $response = new http\Env\Response;
20 /* avoid OOM with $response->getBody()->append($request); */
21 $request->toStream($response->getBody()->getResource());
22 $response->send($client);
23 });