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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/standalone.status » ('j') | 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 // Regression test for http://code.google.com/p/dart/issues/detail?id=6393.
6
7 import "dart:io";
8 import "dart:uri";
9
10 var client = new HttpClient();
11 var clientRequest;
12
13 void main() {
14 var server = new HttpServer();
15 server.listen("127.0.0.1", 0);
16 server.defaultRequestHandler = (req, rsp) {
17 req.inputStream.onData = () {
18 req.inputStream.read();
19 rsp.outputStream.close();
20 };
21 req.inputStream.onClosed = () {
22 client.shutdown();
23 server.close();
24 };
25 };
26
27 var connection = client.openUrl(
28 "POST",
29 new Uri.fromString("http://localhost:${server.port}/"));
30 connection.onRequest = (request) {
31 // Keep a reference to the client request object.
32 clientRequest = request;
33 request.outputStream.write([0]);
34 };
35 connection.onResponse = (response) {
36 response.inputStream.onClosed = () {
37 // Wait with closing the client request until the response is done.
38 clientRequest.outputStream.close();
39 };
40 };
41 }
OLDNEW
« 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