| 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 _OUTGOING_BUFFER_SIZE = 8 * 1024; | 7 const int _OUTGOING_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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 _ProxyCredentials proxyCreds; // Credentials used to authorize proxy. | 1322 _ProxyCredentials proxyCreds; // Credentials used to authorize proxy. |
| 1323 _SiteCredentials creds; // Credentials used to authorize this request. | 1323 _SiteCredentials creds; // Credentials used to authorize this request. |
| 1324 var outgoing = new _HttpOutgoing(_socket); | 1324 var outgoing = new _HttpOutgoing(_socket); |
| 1325 // Create new request object, wrapping the outgoing connection. | 1325 // Create new request object, wrapping the outgoing connection. |
| 1326 var request = new _HttpClientRequest(outgoing, | 1326 var request = new _HttpClientRequest(outgoing, |
| 1327 uri, | 1327 uri, |
| 1328 method, | 1328 method, |
| 1329 proxy, | 1329 proxy, |
| 1330 _httpClient, | 1330 _httpClient, |
| 1331 this); | 1331 this); |
| 1332 // For the Host header an IPv6 address must be enclosed in []'s. |
| 1333 var host = uri.host; |
| 1334 if (host.contains(':')) host = "[$host]"; |
| 1332 request.headers | 1335 request.headers |
| 1333 ..host = uri.host | 1336 ..host = host |
| 1334 ..port = port | 1337 ..port = port |
| 1335 .._add(HttpHeaders.ACCEPT_ENCODING, "gzip"); | 1338 .._add(HttpHeaders.ACCEPT_ENCODING, "gzip"); |
| 1336 if (_httpClient.userAgent != null) { | 1339 if (_httpClient.userAgent != null) { |
| 1337 request.headers._add('user-agent', _httpClient.userAgent); | 1340 request.headers._add('user-agent', _httpClient.userAgent); |
| 1338 } | 1341 } |
| 1339 if (proxy.isAuthenticated) { | 1342 if (proxy.isAuthenticated) { |
| 1340 // If the proxy configuration contains user information use that | 1343 // If the proxy configuration contains user information use that |
| 1341 // for proxy basic authorization. | 1344 // for proxy basic authorization. |
| 1342 String auth = _CryptoUtils.bytesToBase64( | 1345 String auth = _CryptoUtils.bytesToBase64( |
| 1343 UTF8.encode("${proxy.username}:${proxy.password}")); | 1346 UTF8.encode("${proxy.username}:${proxy.password}")); |
| (...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2810 const _RedirectInfo(this.statusCode, this.method, this.location); | 2813 const _RedirectInfo(this.statusCode, this.method, this.location); |
| 2811 } | 2814 } |
| 2812 | 2815 |
| 2813 String _getHttpVersion() { | 2816 String _getHttpVersion() { |
| 2814 var version = Platform.version; | 2817 var version = Platform.version; |
| 2815 // Only include major and minor version numbers. | 2818 // Only include major and minor version numbers. |
| 2816 int index = version.indexOf('.', version.indexOf('.') + 1); | 2819 int index = version.indexOf('.', version.indexOf('.') + 1); |
| 2817 version = version.substring(0, index); | 2820 version = version.substring(0, index); |
| 2818 return 'Dart/$version (dart:io)'; | 2821 return 'Dart/$version (dart:io)'; |
| 2819 } | 2822 } |
| OLD | NEW |