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

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

Issue 335373003: New Uri.parse and validation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More test. Created 6 years, 6 months 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
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 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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 String host, 1667 String host,
1668 int port)) { 1668 int port)) {
1669 _badCertificateCallback = callback; 1669 _badCertificateCallback = callback;
1670 } 1670 }
1671 1671
1672 1672
1673 Future<HttpClientRequest> open(String method, 1673 Future<HttpClientRequest> open(String method,
1674 String host, 1674 String host,
1675 int port, 1675 int port,
1676 String path) { 1676 String path) {
1677 Uri uri = new Uri(scheme: "http", host: host, port: port).resolve(path);
1677 // TODO(sgjesse): The path set here can contain both query and 1678 // TODO(sgjesse): The path set here can contain both query and
1678 // fragment. They should be cracked and set correctly. 1679 // fragment. They should be cracked and set correctly.
1679 return _openUrl(method, new Uri( 1680 return _openUrl(method, uri);
1680 scheme: "http", host: host, port: port, path: path));
1681 } 1681 }
1682 1682
1683 Future<HttpClientRequest> openUrl(String method, Uri url) { 1683 Future<HttpClientRequest> openUrl(String method, Uri url) {
1684 return _openUrl(method, url); 1684 return _openUrl(method, url);
1685 } 1685 }
1686 1686
1687 Future<HttpClientRequest> get(String host, int port, String path) 1687 Future<HttpClientRequest> get(String host, int port, String path)
1688 => open("get", host, port, path); 1688 => open("get", host, port, path);
1689 1689
1690 Future<HttpClientRequest> getUrl(Uri url) => _openUrl("get", url); 1690 Future<HttpClientRequest> getUrl(Uri url) => _openUrl("get", url);
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2798 const _RedirectInfo(this.statusCode, this.method, this.location); 2798 const _RedirectInfo(this.statusCode, this.method, this.location);
2799 } 2799 }
2800 2800
2801 String _getHttpVersion() { 2801 String _getHttpVersion() {
2802 var version = Platform.version; 2802 var version = Platform.version;
2803 // Only include major and minor version numbers. 2803 // Only include major and minor version numbers.
2804 int index = version.indexOf('.', version.indexOf('.') + 1); 2804 int index = version.indexOf('.', version.indexOf('.') + 1);
2805 version = version.substring(0, index); 2805 version = version.substring(0, index);
2806 return 'Dart/$version (dart:io)'; 2806 return 'Dart/$version (dart:io)';
2807 } 2807 }
OLDNEW
« no previous file with comments | « sdk/lib/core/uri.dart ('k') | tests/co19/co19-co19.status » ('j') | tests/corelib/uri_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698