| 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 library utils; | 5 library utils; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 | 31 |
| 32 Future<HttpHeaders> getHeaders(int port, String path) { | 32 Future<HttpHeaders> getHeaders(int port, String path) { |
| 33 return new HttpClient().get('localhost', port, path) | 33 return new HttpClient().get('localhost', port, path) |
| 34 .then((request) => request.close()) | 34 .then((request) => request.close()) |
| 35 .then((response) => response.drain().then( | 35 .then((response) => response.drain().then( |
| 36 (_) => response.headers)); | 36 (_) => response.headers)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 | 39 |
| 40 Future<String> getAsString(int port, String path) { |
| 41 return new HttpClient().get('localhost', port, path) |
| 42 .then((request) => request.close()) |
| 43 .then((response) => StringDecoder.decode(response)); |
| 44 } |
| 45 |
| 46 |
| 40 const CERTIFICATE = "localhost_cert"; | 47 const CERTIFICATE = "localhost_cert"; |
| 41 | 48 |
| 42 | 49 |
| 43 setupSecure() { | 50 setupSecure() { |
| 44 Path scriptDir = new Path(new Options().script).directoryPath; | 51 Path scriptDir = new Path(new Options().script).directoryPath; |
| 45 Path certificateDatabase = scriptDir.append('pkcert'); | 52 Path certificateDatabase = scriptDir.append('pkcert'); |
| 46 SecureSocket.initialize(database: certificateDatabase.toNativePath(), | 53 SecureSocket.initialize(database: certificateDatabase.toNativePath(), |
| 47 password: 'dartdart'); | 54 password: 'dartdart'); |
| 48 } | 55 } |
| OLD | NEW |