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

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

Issue 10386040: Avoid using chunked transfer encoding when the HTTP verision is 1.0. (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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 5
6 #import("dart:isolate"); 6 #import("dart:isolate");
7 #import("dart:io"); 7 #import("dart:io");
8 8
9 void testNoBody(int totalConnections) { 9 void testNoBody(int totalConnections) {
10 HttpServer server = new HttpServer(); 10 HttpServer server = new HttpServer();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 conn.onResponse = (HttpClientResponse response) { 72 conn.onResponse = (HttpClientResponse response) {
73 count++; 73 count++;
74 if (count == totalConnections) { 74 if (count == totalConnections) {
75 client.shutdown(); 75 client.shutdown();
76 server.close(); 76 server.close();
77 } 77 }
78 }; 78 };
79 } 79 }
80 } 80 }
81 81
82 void testHttp10() {
83 HttpServer server = new HttpServer();
84 server.onError = (e) => Expect.fail("Unexpected error $e");
85 server.listen("127.0.0.1", 0, 5);
86 server.defaultRequestHandler = (HttpRequest request, HttpResponse response) {
87 OutputStream stream = response.outputStream;
88 Expect.equals("1.0", request.protocolVersion);
89 Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
90 response.contentLength = 0;
91 stream.close();
92 };
93
94 Socket socket = new Socket("127.0.0.1", server.port);
95 socket.onConnect = () {
96 List<int> buffer = new List<int>(1024);
97 socket.outputStream.writeString("GET / HTTP/1.0\r\n\r\n");
98 socket.onData = () => socket.readList(buffer, 0, buffer.length);
99 socket.onClosed = () {
Mads Ager (google) 2012/05/09 07:42:14 Indentation is off.
Søren Gjesse 2012/05/09 08:57:02 Done.
100 socket.close(true);
101 server.close();
102 };
103 };
104 }
105
82 void main() { 106 void main() {
83 testNoBody(5); 107 testNoBody(5);
84 testBody(5); 108 testBody(5);
109 testHttp10();
85 } 110 }
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