| 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:async"; | 6 import "dart:async"; |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 import "dart:uri"; | 8 import "dart:uri"; |
| 9 | 9 |
| 10 class Server { | 10 class Server { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 }); | 98 }); |
| 99 }); | 99 }); |
| 100 // Special handling of Content-Length and Via. | 100 // Special handling of Content-Length and Via. |
| 101 clientRequest.contentLength = request.contentLength; | 101 clientRequest.contentLength = request.contentLength; |
| 102 List<String> via = request.headers[HttpHeaders.VIA]; | 102 List<String> via = request.headers[HttpHeaders.VIA]; |
| 103 String viaPrefix = via == null ? "" : "${via[0]}, "; | 103 String viaPrefix = via == null ? "" : "${via[0]}, "; |
| 104 clientRequest.headers.add( | 104 clientRequest.headers.add( |
| 105 HttpHeaders.VIA, "${viaPrefix}1.1 localhost:$port"); | 105 HttpHeaders.VIA, "${viaPrefix}1.1 localhost:$port"); |
| 106 // Copy all content. | 106 // Copy all content. |
| 107 request.pipe(clientRequest); | 107 return request.pipe(clientRequest); |
| 108 return clientRequest.response; | |
| 109 }) | 108 }) |
| 110 .then((HttpClientResponse clientResponse) { | 109 .then((HttpClientResponse clientResponse) { |
| 111 clientResponse.pipe(request.response); | 110 clientResponse.pipe(request.response); |
| 112 }); | 111 }); |
| 113 }); | 112 }); |
| 114 }); | 113 }); |
| 115 return x.future; | 114 return x.future; |
| 116 } | 115 } |
| 117 | 116 |
| 118 void shutdown() { | 117 void shutdown() { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 InitializeSSL(); | 412 InitializeSSL(); |
| 414 testInvalidProxy(); | 413 testInvalidProxy(); |
| 415 testDirectProxy(); | 414 testDirectProxy(); |
| 416 testProxy(); | 415 testProxy(); |
| 417 testProxyChain(); | 416 testProxyChain(); |
| 418 testProxyFromEnviroment(); | 417 testProxyFromEnviroment(); |
| 419 // This test is not normally run. It can be used for locally testing | 418 // This test is not normally run. It can be used for locally testing |
| 420 // with a real proxy server (e.g. Apache). | 419 // with a real proxy server (e.g. Apache). |
| 421 //testRealProxy(); | 420 //testRealProxy(); |
| 422 } | 421 } |
| OLD | NEW |