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

Unified Diff: tests/standalone/io/http_server_early_client_close_test.dart

Issue 12438008: Fix multiple close of incoming in _HttpParser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « sdk/lib/io/http_parser.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_server_early_client_close_test.dart
diff --git a/tests/standalone/io/http_server_early_client_close_test.dart b/tests/standalone/io/http_server_early_client_close_test.dart
index 591de40284ccfe5de8f86274bf5a692e9ceffa20..72324e2901ddfa1d7c2657eed30c725fdfc331ab 100644
--- a/tests/standalone/io/http_server_early_client_close_test.dart
+++ b/tests/standalone/io/http_server_early_client_close_test.dart
@@ -109,15 +109,15 @@ testEarlyClose2() {
server.listen(
(request) {
String name = new Options().script;
- new File(name).openRead().pipe(request.response);
- },
- onError: (e) { /* ignore */ });
+ new File(name).openRead().pipe(request.response)
+ .catchError((e) { /* ignore */ });
+ });
var count = 0;
makeRequest() {
Socket.connect("127.0.0.1", server.port).then((socket) {
- var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n".codeUnits;
- socket.add(data);
+ var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n";
+ socket.write(data);
socket.close();
socket.done.then((_) {
socket.destroy();
@@ -133,7 +133,32 @@ testEarlyClose2() {
});
}
+void testEarlyClose3() {
+ HttpServer.bind().then((server) {
+ server.listen((request) {
+ var subscription;
+ subscription = request.listen(
+ (_) {},
+ onError: (error) {
+ // subscription.cancel should not trigger an error.
+ subscription.cancel();
+ server.close();
+ });
+ });
+ Socket.connect("localhost", server.port)
+ .then((socket) {
+ socket.write("GET / HTTP/1.1\r\n");
+ socket.write("Content-Length: 10\r\n");
+ socket.write("\r\n");
+ socket.write("data");
+ socket.close();
+ socket.listen((_) {});
+ });
+ });
+}
+
void main() {
testEarlyClose1();
-// testEarlyClose2();
+ testEarlyClose2();
+ testEarlyClose3();
}
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698