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 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 request.headers.set(HttpHeaders.AUTHORIZATION, "Basic $auth"); | 1326 request.headers.set(HttpHeaders.AUTHORIZATION, "Basic $auth"); |
1327 } else { | 1327 } else { |
1328 // Look for credentials. | 1328 // Look for credentials. |
1329 creds = _httpClient._findCredentials(uri); | 1329 creds = _httpClient._findCredentials(uri); |
1330 if (creds != null) { | 1330 if (creds != null) { |
1331 creds.authorize(request); | 1331 creds.authorize(request); |
1332 } | 1332 } |
1333 } | 1333 } |
1334 // Start sending the request (lazy, delayed until the user provides | 1334 // Start sending the request (lazy, delayed until the user provides |
1335 // data). | 1335 // data). |
1336 _httpParser.responseToMethod = method; | 1336 _httpParser.isHead = method == "HEAD"; |
1337 _streamFuture = outgoing.done | 1337 _streamFuture = outgoing.done |
1338 .then((s) { | 1338 .then((s) { |
1339 // Request sent, set up response completer. | 1339 // Request sent, set up response completer. |
1340 _nextResponseCompleter = new Completer(); | 1340 _nextResponseCompleter = new Completer(); |
1341 | 1341 |
1342 // Listen for response. | 1342 // Listen for response. |
1343 _nextResponseCompleter.future | 1343 _nextResponseCompleter.future |
1344 .then((incoming) { | 1344 .then((incoming) { |
1345 _currentUri = null; | 1345 _currentUri = null; |
1346 incoming.dataDone.then((closing) { | 1346 incoming.dataDone.then((closing) { |
(...skipping 1221 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 |