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

Side by Side Diff: sdk/lib/io/http_impl.dart

Issue 108323003: Ignore HandshakeExceptions in HttpServer, as they are request(socket)-bound and not fatal for the s… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test. Created 7 years 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 | « no previous file | tests/standalone/io/https_server_test.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 const int _HEADERS_BUFFER_SIZE = 8 * 1024; 7 const int _HEADERS_BUFFER_SIZE = 8 * 1024;
8 8
9 class _HttpIncoming extends Stream<List<int>> { 9 class _HttpIncoming extends Stream<List<int>> {
10 final int _transferLength; 10 final int _transferLength;
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 void _cancel() { 580 void _cancel() {
581 if (_subscription != null) { 581 if (_subscription != null) {
582 StreamSubscription subscription = _subscription; 582 StreamSubscription subscription = _subscription;
583 _subscription = null; 583 _subscription = null;
584 subscription.cancel(); 584 subscription.cancel();
585 } 585 }
586 } 586 }
587 587
588 bool _ignoreError(error) 588 bool _ignoreError(error)
589 => error is SocketException && _outbound is HttpResponse; 589 => (error is SocketException || error is TlsException) &&
590 _outbound is HttpResponse;
590 591
591 _ensureController() { 592 _ensureController() {
592 if (_controller != null) return; 593 if (_controller != null) return;
593 _controller = new StreamController(sync: true, 594 _controller = new StreamController(sync: true,
594 onPause: () => _subscription.pause(), 595 onPause: () => _subscription.pause(),
595 onResume: () => _subscription.resume(), 596 onResume: () => _subscription.resume(),
596 onListen: () => _subscription.resume(), 597 onListen: () => _subscription.resume(),
597 onCancel: _cancel); 598 onCancel: _cancel);
598 _outbound._addStream(_controller.stream) 599 _outbound._addStream(_controller.stream)
599 .then((_) { 600 .then((_) {
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 {Function onError, 2049 {Function onError,
2049 void onDone(), 2050 void onDone(),
2050 bool cancelOnError}) { 2051 bool cancelOnError}) {
2051 _serverSocket.listen( 2052 _serverSocket.listen(
2052 (Socket socket) { 2053 (Socket socket) {
2053 socket.setOption(SocketOption.TCP_NODELAY, true); 2054 socket.setOption(SocketOption.TCP_NODELAY, true);
2054 // Accept the client connection. 2055 // Accept the client connection.
2055 _HttpConnection connection = new _HttpConnection(socket, this); 2056 _HttpConnection connection = new _HttpConnection(socket, this);
2056 _connections.add(connection); 2057 _connections.add(connection);
2057 }, 2058 },
2058 onError: _controller.addError, 2059 onError: (error) {
2060 // Ignore HandshakeExceptions as they are bound to a single request,
2061 // and are not fatal for the server.
2062 if (error is! HandshakeException) {
2063 _controller.addError(error);
2064 }
2065 },
2059 onDone: _controller.close); 2066 onDone: _controller.close);
2060 return _controller.stream.listen(onData, 2067 return _controller.stream.listen(onData,
2061 onError: onError, 2068 onError: onError,
2062 onDone: onDone, 2069 onDone: onDone,
2063 cancelOnError: cancelOnError); 2070 cancelOnError: cancelOnError);
2064 } 2071 }
2065 2072
2066 Future close({bool force: false}) { 2073 Future close({bool force: false}) {
2067 closed = true; 2074 closed = true;
2068 Future result; 2075 Future result;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 2577
2571 String _getHttpVersion() { 2578 String _getHttpVersion() {
2572 var version = Platform.version; 2579 var version = Platform.version;
2573 // Only include major and minor version numbers. 2580 // Only include major and minor version numbers.
2574 int index = version.indexOf('.', version.indexOf('.') + 1); 2581 int index = version.indexOf('.', version.indexOf('.') + 1);
2575 version = version.substring(0, index); 2582 version = version.substring(0, index);
2576 return 'Dart/$version (dart:io)'; 2583 return 'Dart/$version (dart:io)';
2577 } 2584 }
2578 2585
2579 2586
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/https_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698