| 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 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 address, | 1835 address, |
| 1836 port, | 1836 port, |
| 1837 certificate_name, | 1837 certificate_name, |
| 1838 backlog: backlog, | 1838 backlog: backlog, |
| 1839 requestClientCertificate: requestClientCertificate) | 1839 requestClientCertificate: requestClientCertificate) |
| 1840 .then((socket) { | 1840 .then((socket) { |
| 1841 return new _HttpServer._(socket, true); | 1841 return new _HttpServer._(socket, true); |
| 1842 }); | 1842 }); |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 _HttpServer._(this._serverSocket, this._closeServer); | 1845 _HttpServer._(this._serverSocket, this._closeServer) { |
| 1846 _controller = new StreamController<HttpRequest>(sync: true, |
| 1847 onCancel: close); |
| 1848 } |
| 1846 | 1849 |
| 1847 _HttpServer.listenOn(ServerSocket this._serverSocket) | 1850 _HttpServer.listenOn(ServerSocket this._serverSocket) |
| 1848 : _closeServer = false; | 1851 : _closeServer = false { |
| 1852 _controller = new StreamController<HttpRequest>(sync: true, |
| 1853 onCancel: close); |
| 1854 } |
| 1849 | 1855 |
| 1850 StreamSubscription<HttpRequest> listen(void onData(HttpRequest event), | 1856 StreamSubscription<HttpRequest> listen(void onData(HttpRequest event), |
| 1851 {void onError(error), | 1857 {void onError(error), |
| 1852 void onDone(), | 1858 void onDone(), |
| 1853 bool cancelOnError}) { | 1859 bool cancelOnError}) { |
| 1854 _serverSocket.listen( | 1860 _serverSocket.listen( |
| 1855 (Socket socket) { | 1861 (Socket socket) { |
| 1856 socket.setOption(SocketOption.TCP_NODELAY, true); | 1862 socket.setOption(SocketOption.TCP_NODELAY, true); |
| 1857 // Accept the client connection. | 1863 // Accept the client connection. |
| 1858 _HttpConnection connection = new _HttpConnection(socket, this); | 1864 _HttpConnection connection = new _HttpConnection(socket, this); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 | 1936 |
| 1931 // Indicated if the http server has been closed. | 1937 // Indicated if the http server has been closed. |
| 1932 bool closed = false; | 1938 bool closed = false; |
| 1933 | 1939 |
| 1934 // The server listen socket. | 1940 // The server listen socket. |
| 1935 final ServerSocket _serverSocket; | 1941 final ServerSocket _serverSocket; |
| 1936 final bool _closeServer; | 1942 final bool _closeServer; |
| 1937 | 1943 |
| 1938 // Set of currently connected clients. | 1944 // Set of currently connected clients. |
| 1939 final Set<_HttpConnection> _connections = new Set<_HttpConnection>(); | 1945 final Set<_HttpConnection> _connections = new Set<_HttpConnection>(); |
| 1940 final StreamController<HttpRequest> _controller | 1946 StreamController<HttpRequest> _controller; |
| 1941 = new StreamController<HttpRequest>(sync: true); | |
| 1942 | 1947 |
| 1943 // TODO(ajohnsen): Use close queue? | 1948 // TODO(ajohnsen): Use close queue? |
| 1944 } | 1949 } |
| 1945 | 1950 |
| 1946 | 1951 |
| 1947 class _ProxyConfiguration { | 1952 class _ProxyConfiguration { |
| 1948 static const String PROXY_PREFIX = "PROXY "; | 1953 static const String PROXY_PREFIX = "PROXY "; |
| 1949 static const String DIRECT_PREFIX = "DIRECT"; | 1954 static const String DIRECT_PREFIX = "DIRECT"; |
| 1950 | 1955 |
| 1951 _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() { | 1956 _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() { |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2337 | 2342 |
| 2338 | 2343 |
| 2339 class _RedirectInfo implements RedirectInfo { | 2344 class _RedirectInfo implements RedirectInfo { |
| 2340 const _RedirectInfo(int this.statusCode, | 2345 const _RedirectInfo(int this.statusCode, |
| 2341 String this.method, | 2346 String this.method, |
| 2342 Uri this.location); | 2347 Uri this.location); |
| 2343 final int statusCode; | 2348 final int statusCode; |
| 2344 final String method; | 2349 final String method; |
| 2345 final Uri location; | 2350 final Uri location; |
| 2346 } | 2351 } |
| OLD | NEW |