Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 // | |
| 5 // VMOptions= | |
| 6 // VMOptions=--short_socket_read | |
| 7 // VMOptions=--short_socket_write | |
| 8 // VMOptions=--short_socket_read --short_socket_write | |
| 9 | |
| 10 #import("dart:isolate"); | |
| 11 #import("dart:io"); | |
| 12 | |
| 13 void main() { | |
| 14 var tls = new TlsSocket("www.google.dk", 443); | |
| 15 String message = ''; | |
| 16 tls.onConnect = () { | |
| 17 var get_list = | |
| 18 "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes(); | |
|
Søren Gjesse
2012/07/31 09:07:15
Perhaps use HTTP/1.1 for the test.
| |
| 19 // tls.writeList(get_list, 0, get_list.length); | |
| 20 var push = new Timer(5000, (ignore) { | |
| 21 tls.writeList(get_list, 0, 20); | |
| 22 tls.writeList(get_list, 20, get_list.length - 20); | |
| 23 }); | |
| 24 | |
| 25 }; | |
| 26 tls.onData = () { | |
| 27 var buffer = new List(2000); | |
| 28 int len = tls.readList(buffer, 0, 2000); | |
| 29 print('length: $len'); | |
| 30 var received = new String.fromCharCodes(buffer.getRange(0, len)); | |
| 31 message = '$message$received'; | |
| 32 print(received); | |
| 33 // if (isCompleteChunkedTransfer(message)) { | |
|
Mads Ager (google)
2012/07/31 10:16:01
Code in comment.
Bill Hesse
2012/08/08 17:00:05
Done.
| |
| 34 // tls.close(); | |
| 35 //} | |
| 36 }; | |
| 37 tls.onClosed = () { | |
| 38 print('tls close event fired'); | |
| 39 // tls.close(); | |
|
Mads Ager (google)
2012/07/31 10:16:01
Code in comment.
Bill Hesse
2012/08/08 17:00:05
Done.
| |
| 40 print(message); | |
| 41 print('\nREACHED END OF TEST'); | |
| 42 }; | |
| 43 } | |
| OLD | NEW |