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 import "package:path/path.dart"; |
10 | 10 |
11 Future<int> getStatusCode(int port, | 11 Future<int> getStatusCode(int port, |
12 String path, | 12 String path, |
13 {String host, | 13 {String host, |
14 bool secure: false, | 14 bool secure: false, |
15 DateTime ifModifiedSince, | 15 DateTime ifModifiedSince, |
16 bool rawPath: false}) { | 16 bool rawPath: false}) { |
17 var uri; | 17 var uri; |
18 if (rawPath) { | 18 if (rawPath) { |
19 uri = new Uri(scheme: secure ? 'https' : 'http', | 19 uri = new Uri(scheme: secure ? 'https' : 'http', |
(...skipping 30 matching lines...) Expand all Loading... |
50 return new HttpClient().get('localhost', port, path) | 50 return new HttpClient().get('localhost', port, path) |
51 .then((request) => request.close()) | 51 .then((request) => request.close()) |
52 .then((response) => StringDecoder.decode(response)); | 52 .then((response) => StringDecoder.decode(response)); |
53 } | 53 } |
54 | 54 |
55 | 55 |
56 const CERTIFICATE = "localhost_cert"; | 56 const CERTIFICATE = "localhost_cert"; |
57 | 57 |
58 | 58 |
59 setupSecure() { | 59 setupSecure() { |
60 Path scriptDir = new Path(new Options().script).directoryPath; | 60 String scriptDir = dirname(new Options().script); |
61 Path certificateDatabase = scriptDir.append('pkcert'); | 61 String certificateDatabase = join(scriptDir, 'pkcert'); |
62 SecureSocket.initialize(database: certificateDatabase.toNativePath(), | 62 SecureSocket.initialize(database: certificateDatabase, |
63 password: 'dartdart'); | 63 password: 'dartdart'); |
64 } | 64 } |
OLD | NEW |