| 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 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2294 InternetAddress get address { | 2294 InternetAddress get address { |
| 2295 if (closed) throw new HttpException("HttpServer is not bound to a socket"); | 2295 if (closed) throw new HttpException("HttpServer is not bound to a socket"); |
| 2296 return _serverSocket.address; | 2296 return _serverSocket.address; |
| 2297 } | 2297 } |
| 2298 | 2298 |
| 2299 set sessionTimeout(int timeout) { | 2299 set sessionTimeout(int timeout) { |
| 2300 _sessionManager.sessionTimeout = timeout; | 2300 _sessionManager.sessionTimeout = timeout; |
| 2301 } | 2301 } |
| 2302 | 2302 |
| 2303 void _handleRequest(_HttpRequest request) { | 2303 void _handleRequest(_HttpRequest request) { |
| 2304 // Delay the request until the isolate's message-queue is handled. | 2304 if (!closed) { |
| 2305 // This greatly improves scheduling when a lot of requests are active. | 2305 _controller.add(request); |
| 2306 Timer.run(() { | 2306 } else { |
| 2307 if (!closed) { | 2307 request._httpConnection.destroy(); |
| 2308 _controller.add(request); | 2308 } |
| 2309 } else { | |
| 2310 request._httpConnection.destroy(); | |
| 2311 } | |
| 2312 }); | |
| 2313 } | 2309 } |
| 2314 | 2310 |
| 2315 void _handleError(error) { | 2311 void _handleError(error) { |
| 2316 if (!closed) _controller.addError(error); | 2312 if (!closed) _controller.addError(error); |
| 2317 } | 2313 } |
| 2318 | 2314 |
| 2319 void _connectionClosed(_HttpConnection connection) { | 2315 void _connectionClosed(_HttpConnection connection) { |
| 2320 // Remove itself from either idle or active connections. | 2316 // Remove itself from either idle or active connections. |
| 2321 connection.unlink(); | 2317 connection.unlink(); |
| 2322 _maybePerformCleanup(); | 2318 _maybePerformCleanup(); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2813 const _RedirectInfo(this.statusCode, this.method, this.location); | 2809 const _RedirectInfo(this.statusCode, this.method, this.location); |
| 2814 } | 2810 } |
| 2815 | 2811 |
| 2816 String _getHttpVersion() { | 2812 String _getHttpVersion() { |
| 2817 var version = Platform.version; | 2813 var version = Platform.version; |
| 2818 // Only include major and minor version numbers. | 2814 // Only include major and minor version numbers. |
| 2819 int index = version.indexOf('.', version.indexOf('.') + 1); | 2815 int index = version.indexOf('.', version.indexOf('.') + 1); |
| 2820 version = version.substring(0, index); | 2816 version = version.substring(0, index); |
| 2821 return 'Dart/$version (dart:io)'; | 2817 return 'Dart/$version (dart:io)'; |
| 2822 } | 2818 } |
| OLD | NEW |