| 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 _HEADERS_BUFFER_SIZE = 8 * 1024; | 7 const int _HEADERS_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 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 | 2000 |
| 2001 bool get _isActive => _state == _ACTIVE; | 2001 bool get _isActive => _state == _ACTIVE; |
| 2002 bool get _isIdle => _state == _IDLE; | 2002 bool get _isIdle => _state == _IDLE; |
| 2003 bool get _isClosing => _state == _CLOSING; | 2003 bool get _isClosing => _state == _CLOSING; |
| 2004 bool get _isDetached => _state == _DETACHED; | 2004 bool get _isDetached => _state == _DETACHED; |
| 2005 } | 2005 } |
| 2006 | 2006 |
| 2007 | 2007 |
| 2008 // HTTP server waiting for socket connections. | 2008 // HTTP server waiting for socket connections. |
| 2009 class _HttpServer extends Stream<HttpRequest> implements HttpServer { | 2009 class _HttpServer extends Stream<HttpRequest> implements HttpServer { |
| 2010 String serverHeader = _getHttpVersion(); | 2010 String serverHeader; |
| 2011 | 2011 |
| 2012 Duration idleTimeout = const Duration(seconds: 120); | 2012 Duration idleTimeout = const Duration(seconds: 120); |
| 2013 | 2013 |
| 2014 static Future<HttpServer> bind(address, int port, int backlog) { | 2014 static Future<HttpServer> bind(address, int port, int backlog) { |
| 2015 return ServerSocket.bind(address, port, backlog: backlog).then((socket) { | 2015 return ServerSocket.bind(address, port, backlog: backlog).then((socket) { |
| 2016 return new _HttpServer._(socket, true); | 2016 return new _HttpServer._(socket, true); |
| 2017 }); | 2017 }); |
| 2018 } | 2018 } |
| 2019 | 2019 |
| 2020 static Future<HttpServer> bindSecure(address, | 2020 static Future<HttpServer> bindSecure(address, |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 const _RedirectInfo(this.statusCode, this.method, this.location); | 2568 const _RedirectInfo(this.statusCode, this.method, this.location); |
| 2569 } | 2569 } |
| 2570 | 2570 |
| 2571 String _getHttpVersion() { | 2571 String _getHttpVersion() { |
| 2572 var version = Platform.version; | 2572 var version = Platform.version; |
| 2573 // Only include major and minor version numbers. | 2573 // Only include major and minor version numbers. |
| 2574 int index = version.indexOf('.', version.indexOf('.') + 1); | 2574 int index = version.indexOf('.', version.indexOf('.') + 1); |
| 2575 version = version.substring(0, index); | 2575 version = version.substring(0, index); |
| 2576 return 'Dart/$version (dart:io)'; | 2576 return 'Dart/$version (dart:io)'; |
| 2577 } | 2577 } |
| OLD | NEW |