| 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 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; | 7 const int _OUTGOING_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 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 .then((socket) { | 2081 .then((socket) { |
| 2082 return new _HttpServer._(socket, true); | 2082 return new _HttpServer._(socket, true); |
| 2083 }); | 2083 }); |
| 2084 } | 2084 } |
| 2085 | 2085 |
| 2086 _HttpServer._(this._serverSocket, this._closeServer) { | 2086 _HttpServer._(this._serverSocket, this._closeServer) { |
| 2087 _controller = new StreamController<HttpRequest>(sync: true, | 2087 _controller = new StreamController<HttpRequest>(sync: true, |
| 2088 onCancel: close); | 2088 onCancel: close); |
| 2089 idleTimeout = const Duration(seconds: 120); | 2089 idleTimeout = const Duration(seconds: 120); |
| 2090 _servers[_serviceId] = this; | 2090 _servers[_serviceId] = this; |
| 2091 _serverSocket._owner = this; |
| 2091 } | 2092 } |
| 2092 | 2093 |
| 2093 _HttpServer.listenOn(this._serverSocket) : _closeServer = false { | 2094 _HttpServer.listenOn(this._serverSocket) : _closeServer = false { |
| 2094 _controller = new StreamController<HttpRequest>(sync: true, | 2095 _controller = new StreamController<HttpRequest>(sync: true, |
| 2095 onCancel: close); | 2096 onCancel: close); |
| 2096 idleTimeout = const Duration(seconds: 120); | 2097 idleTimeout = const Duration(seconds: 120); |
| 2097 _servers[_serviceId] = this; | 2098 _servers[_serviceId] = this; |
| 2099 try { _serverSocket._owner = this; } catch (_) {} |
| 2098 } | 2100 } |
| 2099 | 2101 |
| 2100 Duration get idleTimeout => _idleTimeout; | 2102 Duration get idleTimeout => _idleTimeout; |
| 2101 | 2103 |
| 2102 void set idleTimeout(Duration duration) { | 2104 void set idleTimeout(Duration duration) { |
| 2103 if (_idleTimer != null) { | 2105 if (_idleTimer != null) { |
| 2104 _idleTimer.cancel(); | 2106 _idleTimer.cancel(); |
| 2105 _idleTimer = null; | 2107 _idleTimer = null; |
| 2106 } | 2108 } |
| 2107 _idleTimeout = duration; | 2109 _idleTimeout = duration; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 | 2456 |
| 2455 InternetAddress get remoteAddress => _socket.remoteAddress; | 2457 InternetAddress get remoteAddress => _socket.remoteAddress; |
| 2456 | 2458 |
| 2457 int get remotePort => _socket.remotePort; | 2459 int get remotePort => _socket.remotePort; |
| 2458 | 2460 |
| 2459 bool setOption(SocketOption option, bool enabled) { | 2461 bool setOption(SocketOption option, bool enabled) { |
| 2460 return _socket.setOption(option, enabled); | 2462 return _socket.setOption(option, enabled); |
| 2461 } | 2463 } |
| 2462 | 2464 |
| 2463 Map _toJSON(bool ref) => _socket._toJSON(ref); | 2465 Map _toJSON(bool ref) => _socket._toJSON(ref); |
| 2466 void set _owner(owner) { _socket._owner = owner; } |
| 2464 } | 2467 } |
| 2465 | 2468 |
| 2466 | 2469 |
| 2467 class _AuthenticationScheme { | 2470 class _AuthenticationScheme { |
| 2468 final int _scheme; | 2471 final int _scheme; |
| 2469 | 2472 |
| 2470 static const UNKNOWN = const _AuthenticationScheme(-1); | 2473 static const UNKNOWN = const _AuthenticationScheme(-1); |
| 2471 static const BASIC = const _AuthenticationScheme(0); | 2474 static const BASIC = const _AuthenticationScheme(0); |
| 2472 static const DIGEST = const _AuthenticationScheme(1); | 2475 static const DIGEST = const _AuthenticationScheme(1); |
| 2473 | 2476 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2702 const _RedirectInfo(this.statusCode, this.method, this.location); | 2705 const _RedirectInfo(this.statusCode, this.method, this.location); |
| 2703 } | 2706 } |
| 2704 | 2707 |
| 2705 String _getHttpVersion() { | 2708 String _getHttpVersion() { |
| 2706 var version = Platform.version; | 2709 var version = Platform.version; |
| 2707 // Only include major and minor version numbers. | 2710 // Only include major and minor version numbers. |
| 2708 int index = version.indexOf('.', version.indexOf('.') + 1); | 2711 int index = version.indexOf('.', version.indexOf('.') + 1); |
| 2709 version = version.substring(0, index); | 2712 version = version.substring(0, index); |
| 2710 return 'Dart/$version (dart:io)'; | 2713 return 'Dart/$version (dart:io)'; |
| 2711 } | 2714 } |
| OLD | NEW |