| 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 void _cancel() { | 553 void _cancel() { |
| 554 if (_subscription != null) { | 554 if (_subscription != null) { |
| 555 StreamSubscription subscription = _subscription; | 555 StreamSubscription subscription = _subscription; |
| 556 _subscription = null; | 556 _subscription = null; |
| 557 subscription.cancel(); | 557 subscription.cancel(); |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 | 560 |
| 561 _ensureController() { | 561 _ensureController() { |
| 562 if (_controller != null) return; | 562 if (_controller != null) return; |
| 563 _controller = new StreamController(onPause: () => _subscription.pause(), | 563 _controller = new StreamController(sync: true, |
| 564 onPause: () => _subscription.pause(), |
| 564 onResume: () => _subscription.resume(), | 565 onResume: () => _subscription.resume(), |
| 565 onListen: () => _subscription.resume(), | 566 onListen: () => _subscription.resume(), |
| 566 onCancel: _cancel); | 567 onCancel: _cancel); |
| 567 _outbound._addStream(_controller.stream) | 568 _outbound._addStream(_controller.stream) |
| 568 .then((_) { | 569 .then((_) { |
| 569 _cancel(); | 570 _cancel(); |
| 570 _done(); | 571 _done(); |
| 571 _closeCompleter.complete(_outbound); | 572 _closeCompleter.complete(_outbound); |
| 572 }, | 573 }, |
| 573 onError: (error) { | 574 onError: (error) { |
| (...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1922 // Indicated if the http server has been closed. | 1923 // Indicated if the http server has been closed. |
| 1923 bool closed = false; | 1924 bool closed = false; |
| 1924 | 1925 |
| 1925 // The server listen socket. | 1926 // The server listen socket. |
| 1926 final ServerSocket _serverSocket; | 1927 final ServerSocket _serverSocket; |
| 1927 final bool _closeServer; | 1928 final bool _closeServer; |
| 1928 | 1929 |
| 1929 // Set of currently connected clients. | 1930 // Set of currently connected clients. |
| 1930 final Set<_HttpConnection> _connections = new Set<_HttpConnection>(); | 1931 final Set<_HttpConnection> _connections = new Set<_HttpConnection>(); |
| 1931 final StreamController<HttpRequest> _controller | 1932 final StreamController<HttpRequest> _controller |
| 1932 = new StreamController<HttpRequest>(); | 1933 = new StreamController<HttpRequest>(sync: true); |
| 1933 | 1934 |
| 1934 // TODO(ajohnsen): Use close queue? | 1935 // TODO(ajohnsen): Use close queue? |
| 1935 } | 1936 } |
| 1936 | 1937 |
| 1937 | 1938 |
| 1938 class _ProxyConfiguration { | 1939 class _ProxyConfiguration { |
| 1939 static const String PROXY_PREFIX = "PROXY "; | 1940 static const String PROXY_PREFIX = "PROXY "; |
| 1940 static const String DIRECT_PREFIX = "DIRECT"; | 1941 static const String DIRECT_PREFIX = "DIRECT"; |
| 1941 | 1942 |
| 1942 _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() { | 1943 _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() { |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 | 2329 |
| 2329 | 2330 |
| 2330 class _RedirectInfo implements RedirectInfo { | 2331 class _RedirectInfo implements RedirectInfo { |
| 2331 const _RedirectInfo(int this.statusCode, | 2332 const _RedirectInfo(int this.statusCode, |
| 2332 String this.method, | 2333 String this.method, |
| 2333 Uri this.location); | 2334 Uri this.location); |
| 2334 final int statusCode; | 2335 final int statusCode; |
| 2335 final String method; | 2336 final String method; |
| 2336 final Uri location; | 2337 final Uri location; |
| 2337 } | 2338 } |
| OLD | NEW |