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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void onDone(), | 120 void onDone(), |
121 bool cancelOnError}) { | 121 bool cancelOnError}) { |
122 return _incoming.listen(onData, | 122 return _incoming.listen(onData, |
123 onError: onError, | 123 onError: onError, |
124 onDone: onDone, | 124 onDone: onDone, |
125 cancelOnError: cancelOnError); | 125 cancelOnError: cancelOnError); |
126 } | 126 } |
127 | 127 |
128 Uri get uri => _incoming.uri; | 128 Uri get uri => _incoming.uri; |
129 | 129 |
| 130 Uri get absoluteUri { |
| 131 var scheme = _httpConnection._socket is SecureSocket ? "https" : "http"; |
| 132 var port = headers.port != null ? headers.port : _httpServer.port; |
| 133 var host = headers.host != null ? headers.host : _httpServer.address.host; |
| 134 return Uri.parse("$scheme://$host:$port$uri"); |
| 135 } |
| 136 |
130 String get method => _incoming.method; | 137 String get method => _incoming.method; |
131 | 138 |
132 HttpSession get session { | 139 HttpSession get session { |
133 if (_session != null) { | 140 if (_session != null) { |
134 if (_session._destroyed) { | 141 if (_session._destroyed) { |
135 // It's destroyed, clear it. | 142 // It's destroyed, clear it. |
136 _session = null; | 143 _session = null; |
137 // Create new session object by calling recursive. | 144 // Create new session object by calling recursive. |
138 return session; | 145 return session; |
139 } | 146 } |
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 | 2584 |
2578 String _getHttpVersion() { | 2585 String _getHttpVersion() { |
2579 var version = Platform.version; | 2586 var version = Platform.version; |
2580 // Only include major and minor version numbers. | 2587 // Only include major and minor version numbers. |
2581 int index = version.indexOf('.', version.indexOf('.') + 1); | 2588 int index = version.indexOf('.', version.indexOf('.') + 1); |
2582 version = version.substring(0, index); | 2589 version = version.substring(0, index); |
2583 return 'Dart/$version (dart:io)'; | 2590 return 'Dart/$version (dart:io)'; |
2584 } | 2591 } |
2585 | 2592 |
2586 | 2593 |
OLD | NEW |