OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // The close queue handles graceful closing of HTTP connections. When | 7 // The close queue handles graceful closing of HTTP connections. When |
8 // a connection is added to the queue it will enter a wait state | 8 // a connection is added to the queue it will enter a wait state |
9 // waiting for all data written and possibly socket shutdown from | 9 // waiting for all data written and possibly socket shutdown from |
10 // peer. | 10 // peer. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 _HttpRequestResponseBase(_HttpConnectionBase this._httpConnection) | 87 _HttpRequestResponseBase(_HttpConnectionBase this._httpConnection) |
88 : _state = START, _headResponse = false; | 88 : _state = START, _headResponse = false; |
89 | 89 |
90 int get contentLength => _headers.contentLength; | 90 int get contentLength => _headers.contentLength; |
91 HttpHeaders get headers => _headers; | 91 HttpHeaders get headers => _headers; |
92 | 92 |
93 bool get persistentConnection { | 93 bool get persistentConnection { |
94 List<String> connection = headers[HttpHeaders.CONNECTION]; | 94 List<String> connection = headers[HttpHeaders.CONNECTION]; |
95 if (_protocolVersion == "1.1") { | 95 if (_protocolVersion == "1.1") { |
96 if (connection == null) return true; | 96 if (connection == null) return true; |
97 return !headers[HttpHeaders.CONNECTION].some( | 97 return !headers[HttpHeaders.CONNECTION].any( |
98 (value) => value.toLowerCase() == "close"); | 98 (value) => value.toLowerCase() == "close"); |
99 } else { | 99 } else { |
100 if (connection == null) return false; | 100 if (connection == null) return false; |
101 return headers[HttpHeaders.CONNECTION].some( | 101 return headers[HttpHeaders.CONNECTION].any( |
102 (value) => value.toLowerCase() == "keep-alive"); | 102 (value) => value.toLowerCase() == "keep-alive"); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 X509Certificate get certificate { | 106 X509Certificate get certificate { |
107 var socket = _httpConnection._socket as SecureSocket; | 107 var socket = _httpConnection._socket as SecureSocket; |
108 return socket == null ? socket : socket.peerCertificate; | 108 return socket == null ? socket : socket.peerCertificate; |
109 } | 109 } |
110 | 110 |
111 void set persistentConnection(bool persistentConnection) { | 111 void set persistentConnection(bool persistentConnection) { |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 } | 1262 } |
1263 | 1263 |
1264 String _method; | 1264 String _method; |
1265 Uri _uri; | 1265 Uri _uri; |
1266 _HttpClientConnection _connection; | 1266 _HttpClientConnection _connection; |
1267 _HttpOutputStream _outputStream; | 1267 _HttpOutputStream _outputStream; |
1268 Function _streamErrorHandler; | 1268 Function _streamErrorHandler; |
1269 bool _emptyBody = true; | 1269 bool _emptyBody = true; |
1270 } | 1270 } |
1271 | 1271 |
1272 | |
1273 class _HttpClientResponse | 1272 class _HttpClientResponse |
1274 extends _HttpRequestResponseBase implements HttpClientResponse { | 1273 extends _HttpRequestResponseBase |
| 1274 implements HttpClientResponse { |
1275 _HttpClientResponse(_HttpClientConnection connection) | 1275 _HttpClientResponse(_HttpClientConnection connection) |
1276 : super(connection) { | 1276 : super(connection) { |
1277 _connection = connection; | 1277 _connection = connection; |
1278 } | 1278 } |
1279 | 1279 |
1280 int get statusCode => _statusCode; | 1280 int get statusCode => _statusCode; |
1281 String get reasonPhrase => _reasonPhrase; | 1281 String get reasonPhrase => _reasonPhrase; |
1282 | 1282 |
1283 bool get isRedirect { | 1283 bool get isRedirect { |
1284 var method = _connection._request._method; | 1284 var method = _connection._request._method; |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2300 | 2300 |
2301 | 2301 |
2302 class _RedirectInfo implements RedirectInfo { | 2302 class _RedirectInfo implements RedirectInfo { |
2303 const _RedirectInfo(int this.statusCode, | 2303 const _RedirectInfo(int this.statusCode, |
2304 String this.method, | 2304 String this.method, |
2305 Uri this.location); | 2305 Uri this.location); |
2306 final int statusCode; | 2306 final int statusCode; |
2307 final String method; | 2307 final String method; |
2308 final Uri location; | 2308 final Uri location; |
2309 } | 2309 } |
OLD | NEW |