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

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

Issue 81083002: Fix bug in handling IPv6 proxy hosts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased 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 | no next file » | 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 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 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 password = userinfo.substring(colon + 1).trim(); 2194 password = userinfo.substring(colon + 1).trim();
2195 } 2195 }
2196 // Look for proxy host and port. 2196 // Look for proxy host and port.
2197 int colon = proxy.lastIndexOf(":"); 2197 int colon = proxy.lastIndexOf(":");
2198 if (colon == -1 || colon == 0 || colon == proxy.length - 1) { 2198 if (colon == -1 || colon == 0 || colon == proxy.length - 1) {
2199 throw new HttpException( 2199 throw new HttpException(
2200 "Invalid proxy configuration $configuration"); 2200 "Invalid proxy configuration $configuration");
2201 } 2201 }
2202 String host = proxy.substring(0, colon).trim(); 2202 String host = proxy.substring(0, colon).trim();
2203 if (host.startsWith("[") && host.endsWith("]")) { 2203 if (host.startsWith("[") && host.endsWith("]")) {
2204 host = host.substring(1, host.length - 2); 2204 host = host.substring(1, host.length - 1);
2205 } 2205 }
2206 String portString = proxy.substring(colon + 1).trim(); 2206 String portString = proxy.substring(colon + 1).trim();
2207 int port; 2207 int port;
2208 try { 2208 try {
2209 port = int.parse(portString); 2209 port = int.parse(portString);
2210 } on FormatException catch (e) { 2210 } on FormatException catch (e) {
2211 throw new HttpException( 2211 throw new HttpException(
2212 "Invalid proxy configuration $configuration, " 2212 "Invalid proxy configuration $configuration, "
2213 "invalid port '$portString'"); 2213 "invalid port '$portString'");
2214 } 2214 }
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
2578 2578
2579 2579
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698