| OLD | NEW |
| 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 class _HttpIncoming extends Stream<List<int>> { | 7 class _HttpIncoming extends Stream<List<int>> { |
| 8 final int _transferLength; | 8 final int _transferLength; |
| 9 final Completer _dataCompleter = new Completer(); | 9 final Completer _dataCompleter = new Completer(); |
| 10 Stream<List<int>> _stream; | 10 Stream<List<int>> _stream; |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 } | 1219 } |
| 1220 _activeConnections.add(connection); | 1220 _activeConnections.add(connection); |
| 1221 return new Future.immediate(new _ConnnectionInfo(connection, proxy)); | 1221 return new Future.immediate(new _ConnnectionInfo(connection, proxy)); |
| 1222 } | 1222 } |
| 1223 return (isSecure && proxy.isDirect | 1223 return (isSecure && proxy.isDirect |
| 1224 ? SecureSocket.connect(host, | 1224 ? SecureSocket.connect(host, |
| 1225 port, | 1225 port, |
| 1226 sendClientCertificate: true) | 1226 sendClientCertificate: true) |
| 1227 : Socket.connect(host, port)) | 1227 : Socket.connect(host, port)) |
| 1228 .then((socket) { | 1228 .then((socket) { |
| 1229 socket.setOption(SocketOption.TCP_NODELAY, true); |
| 1229 var connection = new _HttpClientConnection(key, socket, this); | 1230 var connection = new _HttpClientConnection(key, socket, this); |
| 1230 _activeConnections.add(connection); | 1231 _activeConnections.add(connection); |
| 1231 return new _ConnnectionInfo(connection, proxy); | 1232 return new _ConnnectionInfo(connection, proxy); |
| 1232 }, onError: (error) { | 1233 }, onError: (error) { |
| 1233 // Continue with next proxy. | 1234 // Continue with next proxy. |
| 1234 return connect(error.error); | 1235 return connect(error.error); |
| 1235 }); | 1236 }); |
| 1236 } | 1237 } |
| 1237 return connect(new HttpException("No proxies given")); | 1238 return connect(new HttpException("No proxies given")); |
| 1238 } | 1239 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 | 1382 |
| 1382 _HttpServer.listenOn(ServerSocket this._serverSocket) | 1383 _HttpServer.listenOn(ServerSocket this._serverSocket) |
| 1383 : _closeServer = false; | 1384 : _closeServer = false; |
| 1384 | 1385 |
| 1385 StreamSubscription<HttpRequest> listen(void onData(HttpRequest event), | 1386 StreamSubscription<HttpRequest> listen(void onData(HttpRequest event), |
| 1386 {void onError(AsyncError error), | 1387 {void onError(AsyncError error), |
| 1387 void onDone(), | 1388 void onDone(), |
| 1388 bool unsubscribeOnError}) { | 1389 bool unsubscribeOnError}) { |
| 1389 _serverSocket.listen( | 1390 _serverSocket.listen( |
| 1390 (Socket socket) { | 1391 (Socket socket) { |
| 1392 socket.setOption(SocketOption.TCP_NODELAY, true); |
| 1391 // Accept the client connection. | 1393 // Accept the client connection. |
| 1392 _HttpConnection connection = new _HttpConnection(socket, this); | 1394 _HttpConnection connection = new _HttpConnection(socket, this); |
| 1393 _connections.add(connection); | 1395 _connections.add(connection); |
| 1394 }, | 1396 }, |
| 1395 onError: _controller.addError, | 1397 onError: _controller.addError, |
| 1396 onDone: _controller.close); | 1398 onDone: _controller.close); |
| 1397 return _controller.stream.listen(onData, | 1399 return _controller.stream.listen(onData, |
| 1398 onError: onError, | 1400 onError: onError, |
| 1399 onDone: onDone, | 1401 onDone: onDone, |
| 1400 unsubscribeOnError: unsubscribeOnError); | 1402 unsubscribeOnError: unsubscribeOnError); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 | 1716 |
| 1715 | 1717 |
| 1716 class _RedirectInfo implements RedirectInfo { | 1718 class _RedirectInfo implements RedirectInfo { |
| 1717 const _RedirectInfo(int this.statusCode, | 1719 const _RedirectInfo(int this.statusCode, |
| 1718 String this.method, | 1720 String this.method, |
| 1719 Uri this.location); | 1721 Uri this.location); |
| 1720 final int statusCode; | 1722 final int statusCode; |
| 1721 final String method; | 1723 final String method; |
| 1722 final Uri location; | 1724 final Uri location; |
| 1723 } | 1725 } |
| OLD | NEW |