| 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 class _HttpIncoming extends Stream<List<int>> { | 7 class _HttpIncoming extends Stream<List<int>> { |
| 8 final int _transferLength; | 8 final int _transferLength; |
| 9 final Completer _dataCompleter = new Completer(); | 9 final Completer _dataCompleter = new Completer(); |
| 10 Stream<List<int>> _stream; | 10 Stream<List<int>> _stream; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 284 } |
| 285 | 285 |
| 286 // Fall through to here to perform normal response handling if | 286 // Fall through to here to perform normal response handling if |
| 287 // there is no sensible authorization handling. | 287 // there is no sensible authorization handling. |
| 288 return new Future.value(this); | 288 return new Future.value(this); |
| 289 } | 289 } |
| 290 | 290 |
| 291 List<String> challenge = headers[HttpHeaders.WWW_AUTHENTICATE]; | 291 List<String> challenge = headers[HttpHeaders.WWW_AUTHENTICATE]; |
| 292 assert(challenge != null || challenge.length == 1); | 292 assert(challenge != null || challenge.length == 1); |
| 293 _HeaderValue header = | 293 _HeaderValue header = |
| 294 new _HeaderValue.fromString(challenge[0], parameterSeparator: ","); | 294 _HeaderValue.parse(challenge[0], parameterSeparator: ","); |
| 295 _AuthenticationScheme scheme = | 295 _AuthenticationScheme scheme = |
| 296 new _AuthenticationScheme.fromString(header.value); | 296 new _AuthenticationScheme.fromString(header.value); |
| 297 String realm = header.parameters["realm"]; | 297 String realm = header.parameters["realm"]; |
| 298 | 298 |
| 299 // See if any matching credentials are available. | 299 // See if any matching credentials are available. |
| 300 _Credentials cr = _httpClient._findCredentials(_httpRequest.uri, scheme); | 300 _Credentials cr = _httpClient._findCredentials(_httpRequest.uri, scheme); |
| 301 if (cr != null) { | 301 if (cr != null) { |
| 302 // For basic authentication don't retry already used credentials | 302 // For basic authentication don't retry already used credentials |
| 303 // as they must have already been added to the request causing | 303 // as they must have already been added to the request causing |
| 304 // this authenticate response. | 304 // this authenticate response. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 return _httpClient._openUrlFromRequest(_httpRequest.method, | 364 return _httpClient._openUrlFromRequest(_httpRequest.method, |
| 365 _httpRequest.uri, | 365 _httpRequest.uri, |
| 366 _httpRequest) | 366 _httpRequest) |
| 367 .then((request) => request.close()); | 367 .then((request) => request.close()); |
| 368 }); | 368 }); |
| 369 } | 369 } |
| 370 | 370 |
| 371 List<String> challenge = headers[HttpHeaders.PROXY_AUTHENTICATE]; | 371 List<String> challenge = headers[HttpHeaders.PROXY_AUTHENTICATE]; |
| 372 assert(challenge != null || challenge.length == 1); | 372 assert(challenge != null || challenge.length == 1); |
| 373 _HeaderValue header = | 373 _HeaderValue header = |
| 374 new _HeaderValue.fromString(challenge[0], parameterSeparator: ","); | 374 _HeaderValue.parse(challenge[0], parameterSeparator: ","); |
| 375 _AuthenticationScheme scheme = | 375 _AuthenticationScheme scheme = |
| 376 new _AuthenticationScheme.fromString(header.value); | 376 new _AuthenticationScheme.fromString(header.value); |
| 377 String realm = header.parameters["realm"]; | 377 String realm = header.parameters["realm"]; |
| 378 | 378 |
| 379 // See if any credentials are available. | 379 // See if any credentials are available. |
| 380 var proxy = _httpRequest._proxy; | 380 var proxy = _httpRequest._proxy; |
| 381 | 381 |
| 382 var cr = _httpClient._findProxyCredentials(proxy); | 382 var cr = _httpClient._findProxyCredentials(proxy); |
| 383 if (cr != null) { | 383 if (cr != null) { |
| 384 return retryWithProxyCredentials(cr); | 384 return retryWithProxyCredentials(cr); |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 } else { | 1178 } else { |
| 1179 destroy(); | 1179 destroy(); |
| 1180 } | 1180 } |
| 1181 }); | 1181 }); |
| 1182 // For digest authentication check if the server | 1182 // For digest authentication check if the server |
| 1183 // requests the client to start using a new nonce. | 1183 // requests the client to start using a new nonce. |
| 1184 if (cr != null && cr.scheme == _AuthenticationScheme.DIGEST) { | 1184 if (cr != null && cr.scheme == _AuthenticationScheme.DIGEST) { |
| 1185 var authInfo = incoming.headers["authentication-info"]; | 1185 var authInfo = incoming.headers["authentication-info"]; |
| 1186 if (authInfo != null && authInfo.length == 1) { | 1186 if (authInfo != null && authInfo.length == 1) { |
| 1187 var header = | 1187 var header = |
| 1188 new _HeaderValue.fromString( | 1188 _HeaderValue.parse( |
| 1189 authInfo[0], parameterSeparator: ','); | 1189 authInfo[0], parameterSeparator: ','); |
| 1190 var nextnonce = header.parameters["nextnonce"]; | 1190 var nextnonce = header.parameters["nextnonce"]; |
| 1191 if (nextnonce != null) cr.nonce = nextnonce; | 1191 if (nextnonce != null) cr.nonce = nextnonce; |
| 1192 } | 1192 } |
| 1193 } | 1193 } |
| 1194 request._onIncoming(incoming); | 1194 request._onIncoming(incoming); |
| 1195 }) | 1195 }) |
| 1196 // If we see a state error, we failed to get the 'first' | 1196 // If we see a state error, we failed to get the 'first' |
| 1197 // element. | 1197 // element. |
| 1198 // Transform the error to a HttpParserException, for | 1198 // Transform the error to a HttpParserException, for |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2178 | 2178 |
| 2179 | 2179 |
| 2180 class _RedirectInfo implements RedirectInfo { | 2180 class _RedirectInfo implements RedirectInfo { |
| 2181 const _RedirectInfo(int this.statusCode, | 2181 const _RedirectInfo(int this.statusCode, |
| 2182 String this.method, | 2182 String this.method, |
| 2183 Uri this.location); | 2183 Uri this.location); |
| 2184 final int statusCode; | 2184 final int statusCode; |
| 2185 final String method; | 2185 final String method; |
| 2186 final Uri location; | 2186 final Uri location; |
| 2187 } | 2187 } |
| OLD | NEW |