| Index: sdk/lib/io/http_impl.dart
|
| diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
|
| index f9fedc3410bf898fec9521989910eeef3ea6c366..3e1a059dd6cced6087e766aae6a8e033597f10a3 100644
|
| --- a/sdk/lib/io/http_impl.dart
|
| +++ b/sdk/lib/io/http_impl.dart
|
| @@ -1674,10 +1674,34 @@ class _HttpClient implements HttpClient {
|
| String host,
|
| int port,
|
| String path) {
|
| - // TODO(sgjesse): The path set here can contain both query and
|
| - // fragment. They should be cracked and set correctly.
|
| + const int _NUMBER_SIGN = 0x23;
|
| + const int _QUESTION = 0x3F;
|
| + String pathOnly = path;
|
| + String query;
|
| + String fragment;
|
| + // TODO(lrn): Consider dropping the fragment from the Uri.
|
| + for (int i = 0; i < path.length; i++) {
|
| + int char = path.codeUnitAt(i);
|
| + if (char == _NUMBER_SIGN) {
|
| + pathOnly = path.substring(0, i);
|
| + fragment = path.substring(i + 1);
|
| + break;
|
| + }
|
| + if (char == _QUESTION) {
|
| + pathOnly = path.substring(0, i);
|
| + int queryEnd = path.length;
|
| + int fragmentStart = path.indexOf("#", i + 1);
|
| + if (fragmentStart >= 0) {
|
| + queryEnd = fragmentStart;
|
| + fragment = path.substring(fragmentStart + 1);
|
| + }
|
| + query = path.substring(i + 1, queryEnd);
|
| + break;
|
| + }
|
| + }
|
| return _openUrl(method, new Uri(
|
| - scheme: "http", host: host, port: port, path: path));
|
| + scheme: "http", host: host, port: port, path: pathOnly,
|
| + query: query, fragment: fragment));
|
| }
|
|
|
| Future<HttpClientRequest> openUrl(String method, Uri url) {
|
|
|