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