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

Unified Diff: tests/standalone/io/regress-6521.dart

Issue 11361119: Keep track of the request and response state in the HTTP client connection (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 1 month 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 | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/regress-6521.dart
diff --git a/tests/standalone/io/regress-6521.dart b/tests/standalone/io/regress-6521.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a02025d2cb74ad103b4f4440d687cc7b66adf021
--- /dev/null
+++ b/tests/standalone/io/regress-6521.dart
@@ -0,0 +1,41 @@
+// 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.
+//
+// Regression test for http://code.google.com/p/dart/issues/detail?id=6393.
+
+import "dart:io";
+import "dart:uri";
+
+var client = new HttpClient();
+var clientRequest;
+
+void main() {
+ var server = new HttpServer();
+ server.listen("127.0.0.1", 0);
+ server.defaultRequestHandler = (req, rsp) {
+ req.inputStream.onData = () {
+ req.inputStream.read();
+ rsp.outputStream.close();
+ };
+ req.inputStream.onClosed = () {
+ client.shutdown();
+ server.close();
+ };
+ };
+
+ var connection = client.openUrl(
+ "POST",
+ new Uri.fromString("http://localhost:${server.port}/"));
+ connection.onRequest = (request) {
+ // Keep a reference to the client request object.
+ clientRequest = request;
+ request.outputStream.write([0]);
+ };
+ connection.onResponse = (response) {
+ response.inputStream.onClosed = () {
+ // Wait with closing the client request until the response is done.
+ clientRequest.outputStream.close();
+ };
+ };
+}
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698