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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 _HttpClientResponse(_HttpIncoming _incoming, this._httpRequest, | 164 _HttpClientResponse(_HttpIncoming _incoming, this._httpRequest, |
165 this._httpClient) : super(_incoming) { | 165 this._httpClient) : super(_incoming) { |
166 // Set uri for potential exceptions. | 166 // Set uri for potential exceptions. |
167 _incoming.uri = _httpRequest.uri; | 167 _incoming.uri = _httpRequest.uri; |
168 } | 168 } |
169 | 169 |
170 int get statusCode => _incoming.statusCode; | 170 int get statusCode => _incoming.statusCode; |
171 String get reasonPhrase => _incoming.reasonPhrase; | 171 String get reasonPhrase => _incoming.reasonPhrase; |
172 | 172 |
173 X509Certificate get certificate => | 173 X509Certificate get certificate { |
174 _httpRequest._httpClientConnection._socket.peerCertificate; | 174 // The peerCertificate isn't on a plain socket, so cast to dynamic. |
| 175 var socket = _httpRequest._httpClientConnection._socket; |
| 176 return socket.peerCertificate; |
| 177 } |
175 | 178 |
176 List<Cookie> get cookies { | 179 List<Cookie> get cookies { |
177 if (_cookies != null) return _cookies; | 180 if (_cookies != null) return _cookies; |
178 _cookies = new List<Cookie>(); | 181 _cookies = new List<Cookie>(); |
179 List<String> values = headers[HttpHeaders.SET_COOKIE]; | 182 List<String> values = headers[HttpHeaders.SET_COOKIE]; |
180 if (values != null) { | 183 if (values != null) { |
181 values.forEach((value) { | 184 values.forEach((value) { |
182 _cookies.add(new Cookie.fromSetCookieValue(value)); | 185 _cookies.add(new Cookie.fromSetCookieValue(value)); |
183 }); | 186 }); |
184 } | 187 } |
(...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 const _RedirectInfo(this.statusCode, this.method, this.location); | 2545 const _RedirectInfo(this.statusCode, this.method, this.location); |
2543 } | 2546 } |
2544 | 2547 |
2545 String _getHttpVersion() { | 2548 String _getHttpVersion() { |
2546 var version = Platform.version; | 2549 var version = Platform.version; |
2547 // Only include major and minor version numbers. | 2550 // Only include major and minor version numbers. |
2548 int index = version.indexOf('.', version.indexOf('.') + 1); | 2551 int index = version.indexOf('.', version.indexOf('.') + 1); |
2549 version = version.substring(0, index); | 2552 version = version.substring(0, index); |
2550 return 'Dart/$version (dart:io)'; | 2553 return 'Dart/$version (dart:io)'; |
2551 } | 2554 } |
OLD | NEW |