363d76f4b88be43a61ff0649caafa0c98d5e9a04
[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->send($client);
12
13 /* soak up the request following the connect */
14 new http\Message($client, false);
15 }
16
17 /* return the initial message as response body */
18 $response = new http\Env\Response;
19 /* avoid OOM with $response->getBody()->append($request); */
20 $request->toStream($response->getBody()->getResource());
21 $response->send($client);
22 });