| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // VMOptions= | 5 // VMOptions= |
| 6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
| 7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
| 8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
| 9 | 9 |
| 10 import "dart:async"; | 10 import "dart:async"; |
| 11 import "dart:io"; | 11 import "dart:io"; |
| 12 import "dart:isolate"; | 12 import "dart:isolate"; |
| 13 | 13 |
| 14 | 14 |
| 15 void main() { | 15 void main() { |
| 16 List<int> message = "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes; | 16 List<int> message = "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".codeUnits; |
| 17 int written = 0; | 17 int written = 0; |
| 18 List<String> chunks = <String>[]; | 18 List<String> chunks = <String>[]; |
| 19 SecureSocket.initialize(); | 19 SecureSocket.initialize(); |
| 20 // TODO(whesse): Use a Dart HTTPS server for this test. | 20 // TODO(whesse): Use a Dart HTTPS server for this test. |
| 21 // The Dart HTTPS server works on bleeding-edge, but not on IOv2. | 21 // The Dart HTTPS server works on bleeding-edge, but not on IOv2. |
| 22 // When we use a Dart HTTPS server, allow --short_socket_write. The flag | 22 // When we use a Dart HTTPS server, allow --short_socket_write. The flag |
| 23 // causes fragmentation of the client hello message, which doesn't seem to | 23 // causes fragmentation of the client hello message, which doesn't seem to |
| 24 // work with www.google.dk. | 24 // work with www.google.dk. |
| 25 RawSecureSocket.connect("www.google.dk", 443).then((socket) { | 25 RawSecureSocket.connect("www.google.dk", 443).then((socket) { |
| 26 StreamSubscription subscription; | 26 StreamSubscription subscription; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 String fullPage = chunks.join(); | 72 String fullPage = chunks.join(); |
| 73 Expect.isTrue(fullPage.contains('</body></html>')); | 73 Expect.isTrue(fullPage.contains('</body></html>')); |
| 74 break; | 74 break; |
| 75 default: throw "Unexpected event $event"; | 75 default: throw "Unexpected event $event"; |
| 76 } | 76 } |
| 77 }, onError: (AsyncError a) { | 77 }, onError: (AsyncError a) { |
| 78 Expect.fail("onError handler of RawSecureSocket stream hit: $a"); | 78 Expect.fail("onError handler of RawSecureSocket stream hit: $a"); |
| 79 }); | 79 }); |
| 80 }); | 80 }); |
| 81 } | 81 } |
| OLD | NEW |