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 | |
Søren Gjesse
2012/11/12 12:04:57
How about --short_socket_write and both --short_so
Bill Hesse
2012/11/13 20:11:08
Comment added - TODO below explains why these don'
| |
7 | |
8 #import("dart:isolate"); | |
9 #import("dart:io"); | |
10 | |
11 void main() { | |
12 var testPkcertDatabase = | |
13 new Path.fromNative(new Options().script).directoryPath.append('pkcert/'); | |
Mads Ager (google)
2012/11/12 11:39:08
I still don't see a pkcert directory in this chang
Bill Hesse
2012/11/13 20:11:08
Added.
On 2012/11/12 11:39:08, Mads Ager wrote:
| |
14 TlsSocket.setCertificateDatabase(testPkcertDatabase.toNativePath()); | |
15 // TODO(3593): Use a Dart HTTPS server for this test using TLS server sockets. | |
16 // When we use a Dart HTTPS server, allow --short_socket_write. The flag | |
17 // causes fragmentation of the client hello message, which doesn't seem to | |
18 // work with www.google.dk. | |
19 var tls = new TlsSocket("www.google.dk", 443); | |
20 List<String> chunks = <String>[]; | |
21 tls.onConnect = () { | |
22 var request_bytes = | |
23 "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes; | |
24 tls.writeList(request_bytes, 0, 20); | |
25 tls.writeList(request_bytes, 20, request_bytes.length - 20); | |
26 }; | |
27 tls.onData = () { | |
28 var buffer = new List(2000); | |
29 int len = tls.readList(buffer, 0, 2000); | |
30 var received = new String.fromCharCodes(buffer.getRange(0, len)); | |
31 chunks.add(received); | |
32 }; | |
33 tls.onClosed = () { | |
34 String fullPage = Strings.concatAll(chunks); | |
35 print(fullPage); | |
Mads Ager (google)
2012/11/12 11:39:08
Remove the print. Not sure it is usefully to get g
Bill Hesse
2012/11/13 20:11:08
Done.
| |
36 Expect.isTrue(fullPage.contains('</body></html>')); | |
37 tls.close(); | |
38 }; | |
39 } | |
OLD | NEW |