Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: tests/standalone/io/http_connection_close_test.dart

Issue 10356055: Make the HTTP server close non-persistent connections (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
6 #import("dart:isolate");
7 #import("dart:io");
8
9 void testHttp10Close() {
10 HttpServer server = new HttpServer();
11 server.listen("127.0.0.1", 0, 5);
12
13 Socket socket = new Socket("127.0.0.1", server.port);
14 socket.onConnect = () {
15 List<int> buffer = new List<int>(1024);
16 socket.outputStream.writeString("GET / HTTP/1.0\r\n\r\n");
17 socket.onData = () => socket.readList(buffer, 0, buffer.length);
18 socket.onClosed = () {
19 socket.close(true);
20 server.close();
21 };
22 };
23 }
24
25 void testHttp11Close() {
26 HttpServer server = new HttpServer();
27 server.listen("127.0.0.1", 0, 5);
28
29 Socket socket = new Socket("127.0.0.1", server.port);
30 socket.onConnect = () {
31 List<int> buffer = new List<int>(1024);
32 socket.outputStream.writeString(
33 "GET / HTTP/1.1\r\nConnection: close\r\n\r\n");
34 socket.onData = () => socket.readList(buffer, 0, buffer.length);
35 socket.onClosed = () {
36 socket.close(true);
37 server.close();
38 };
39 };
40 }
41
42 main() {
43 testHttp10Close();
44 testHttp11Close();
45 }
OLDNEW
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698