Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: sdk/lib/io/http_impl.dart

Issue 66603002: Improve the HTTP client error when the provided URI is not suitable (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/io/http_client_exception_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 _proxyCredentials.add(new _ProxyCredentials(host, port, realm, cr)); 1571 _proxyCredentials.add(new _ProxyCredentials(host, port, realm, cr));
1572 } 1572 }
1573 1573
1574 set findProxy(String f(Uri uri)) => _findProxy = f; 1574 set findProxy(String f(Uri uri)) => _findProxy = f;
1575 1575
1576 Future<HttpClientRequest> _openUrl(String method, Uri uri) { 1576 Future<HttpClientRequest> _openUrl(String method, Uri uri) {
1577 if (method == null) { 1577 if (method == null) {
1578 throw new ArgumentError(method); 1578 throw new ArgumentError(method);
1579 } 1579 }
1580 if (method != "CONNECT") { 1580 if (method != "CONNECT") {
1581 if (uri.host.isEmpty || 1581 if (uri.host.isEmpty) {
1582 (uri.scheme != "http" && uri.scheme != "https")) { 1582 throw new ArgumentError("No host specified in URI $uri");
1583 throw new ArgumentError("Unsupported scheme '${uri.scheme}' in $uri"); 1583 } else if (uri.scheme != "http" && uri.scheme != "https") {
1584 throw new ArgumentError(
1585 "Unsupported scheme '${uri.scheme}' in URI $uri");
1584 } 1586 }
1585 } 1587 }
1586 1588
1587 bool isSecure = (uri.scheme == "https"); 1589 bool isSecure = (uri.scheme == "https");
1588 int port = uri.port; 1590 int port = uri.port;
1589 if (port == 0) { 1591 if (port == 0) {
1590 port = isSecure ? 1592 port = isSecure ?
1591 HttpClient.DEFAULT_HTTPS_PORT : 1593 HttpClient.DEFAULT_HTTPS_PORT :
1592 HttpClient.DEFAULT_HTTP_PORT; 1594 HttpClient.DEFAULT_HTTP_PORT;
1593 } 1595 }
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 final Uri location; 2521 final Uri location;
2520 } 2522 }
2521 2523
2522 String _getHttpVersion() { 2524 String _getHttpVersion() {
2523 var version = Platform.version; 2525 var version = Platform.version;
2524 // Only include major and minor version numbers. 2526 // Only include major and minor version numbers.
2525 int index = version.indexOf('.', version.indexOf('.') + 1); 2527 int index = version.indexOf('.', version.indexOf('.') + 1);
2526 version = version.substring(0, index); 2528 version = version.substring(0, index);
2527 return 'Dart/$version (dart:io)'; 2529 return 'Dart/$version (dart:io)';
2528 } 2530 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/http_client_exception_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698