OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:async"; | 5 import "dart:async"; |
6 import "dart:io"; | 6 import "dart:io"; |
7 import "dart:uri"; | 7 import "dart:uri"; |
8 | 8 |
9 class Server { | 9 class Server { |
10 HttpServer server; | 10 HttpServer server; |
(...skipping 25 matching lines...) Expand all Loading... |
36 Expect.equals(1, request.headers[HttpHeaders.VIA].length); | 36 Expect.equals(1, request.headers[HttpHeaders.VIA].length); |
37 Expect.equals( | 37 Expect.equals( |
38 proxyHops, | 38 proxyHops, |
39 request.headers[HttpHeaders.VIA][0].split(",").length); | 39 request.headers[HttpHeaders.VIA][0].split(",").length); |
40 } else { | 40 } else { |
41 Expect.isNull(request.headers[HttpHeaders.VIA]); | 41 Expect.isNull(request.headers[HttpHeaders.VIA]); |
42 } | 42 } |
43 var body = new StringBuffer(); | 43 var body = new StringBuffer(); |
44 request.listen( | 44 request.listen( |
45 (data) { | 45 (data) { |
46 body.add(new String.fromCharCodes(data)); | 46 body.write(new String.fromCharCodes(data)); |
47 }, | 47 }, |
48 onDone: () { | 48 onDone: () { |
49 String path = request.uri.path.substring(1); | 49 String path = request.uri.path.substring(1); |
50 String content = "$path$path$path"; | 50 String content = "$path$path$path"; |
51 Expect.equals(content, body.toString()); | 51 Expect.equals(content, body.toString()); |
52 response.addString(request.uri.path); | 52 response.addString(request.uri.path); |
53 response.close(); | 53 response.close(); |
54 }); | 54 }); |
55 }); | 55 }); |
56 return x.future; | 56 return x.future; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 main() { | 360 main() { |
361 InitializeSSL(); | 361 InitializeSSL(); |
362 testInvalidProxy(); | 362 testInvalidProxy(); |
363 testDirectProxy(); | 363 testDirectProxy(); |
364 testProxy(); | 364 testProxy(); |
365 testProxyChain(); | 365 testProxyChain(); |
366 // This test is not normally run. It can be used for locally testing | 366 // This test is not normally run. It can be used for locally testing |
367 // with a real proxy server (e.g. Apache). | 367 // with a real proxy server (e.g. Apache). |
368 //testRealProxy(); | 368 //testRealProxy(); |
369 } | 369 } |
OLD | NEW |