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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_connection_close_test.dart
diff --git a/tests/standalone/io/http_connection_close_test.dart b/tests/standalone/io/http_connection_close_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..893326136878c014780f14b050c5d8a7a5c6c87a
--- /dev/null
+++ b/tests/standalone/io/http_connection_close_test.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+
+#import("dart:isolate");
+#import("dart:io");
+
+void testHttp10Close() {
+ HttpServer server = new HttpServer();
+ server.listen("127.0.0.1", 0, 5);
+
+ Socket socket = new Socket("127.0.0.1", server.port);
+ socket.onConnect = () {
+ List<int> buffer = new List<int>(1024);
+ socket.outputStream.writeString("GET / HTTP/1.0\r\n\r\n");
+ socket.onData = () => socket.readList(buffer, 0, buffer.length);
+ socket.onClosed = () {
+ socket.close(true);
+ server.close();
+ };
+ };
+}
+
+void testHttp11Close() {
+ HttpServer server = new HttpServer();
+ server.listen("127.0.0.1", 0, 5);
+
+ Socket socket = new Socket("127.0.0.1", server.port);
+ socket.onConnect = () {
+ List<int> buffer = new List<int>(1024);
+ socket.outputStream.writeString(
+ "GET / HTTP/1.1\r\nConnection: close\r\n\r\n");
+ socket.onData = () => socket.readList(buffer, 0, buffer.length);
+ socket.onClosed = () {
+ socket.close(true);
+ server.close();
+ };
+ };
+}
+
+main() {
+ testHttp10Close();
+ testHttp11Close();
+}
« 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