| Index: sdk/lib/io/http_impl.dart
|
| diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
|
| index 8ea7174e6a3040eb1135f88c507448b48d051a64..661858c248d426af5b0d89c4c6a2dc27ad7d727d 100644
|
| --- a/sdk/lib/io/http_impl.dart
|
| +++ b/sdk/lib/io/http_impl.dart
|
| @@ -914,49 +914,54 @@ class _HttpClientRequest extends _HttpOutboundMessage<HttpClientResponse>
|
| _responseCompleter.completeError(error);
|
| }
|
|
|
| - void _writeHeader() {
|
| - var buffer = new _BufferList();
|
| -
|
| - writeSP() => buffer.add(const [_CharCode.SP]);
|
| -
|
| - writeCRLF() => buffer.add(const [_CharCode.CR, _CharCode.LF]);
|
| -
|
| - void writePath() {
|
| - String path = uri.path;
|
| - if (path.length == 0) path = "/";
|
| + // Generate the request URI based on the method and proxy.
|
| + String _requestUri() {
|
| + // Generate the request URI starting from the path component.
|
| + String uriStartingFromPath() {
|
| + String result = uri.path;
|
| + if (result.length == 0) result = "/";
|
| if (uri.query != "") {
|
| if (uri.fragment != "") {
|
| - path = "${path}?${uri.query}#${uri.fragment}";
|
| + result = "${result}?${uri.query}#${uri.fragment}";
|
| } else {
|
| - path = "${path}?${uri.query}";
|
| + result = "${result}?${uri.query}";
|
| }
|
| }
|
| - buffer.add(path.codeUnits);
|
| + return result;
|
| }
|
|
|
| - // Write the request method.
|
| - buffer.add(method.codeUnits);
|
| - writeSP();
|
| - // Write the request URI.
|
| if (_proxy.isDirect) {
|
| - writePath();
|
| + return uriStartingFromPath();
|
| } else {
|
| if (method == "CONNECT") {
|
| // For the connect method the request URI is the host:port of
|
| // the requested destination of the tunnel (see RFC 2817
|
| // section 5.2)
|
| - buffer.add(uri.domain.codeUnits);
|
| - buffer.add(const [_CharCode.COLON]);
|
| - buffer.add(uri.port.toString().codeUnits);
|
| + return "${uri.domain}:${uri.port}";
|
| } else {
|
| if (_httpClientConnection._proxyTunnel) {
|
| - writePath();
|
| + return uriStartingFromPath();
|
| } else {
|
| - buffer.add(uri.toString().codeUnits);
|
| + return uri.toString();
|
| }
|
| }
|
| }
|
| + }
|
| +
|
| + void _writeHeader() {
|
| + var buffer = new _BufferList();
|
| +
|
| + writeSP() => buffer.add(const [_CharCode.SP]);
|
| +
|
| + writeCRLF() => buffer.add(const [_CharCode.CR, _CharCode.LF]);
|
| +
|
| + // Write the request method.
|
| + buffer.add(method.codeUnits);
|
| + writeSP();
|
| + // Write the request URI.
|
| + buffer.add(_requestUri().codeUnits);
|
| writeSP();
|
| + // Write HTTP/1.1.
|
| buffer.add(_Const.HTTP11);
|
| writeCRLF();
|
|
|
| @@ -2134,10 +2139,11 @@ class _HttpClientDigestCredentials
|
| _AuthenticationScheme get scheme => _AuthenticationScheme.DIGEST;
|
|
|
| String authorization(_Credentials credentials, HttpClientRequest request) {
|
| + String requestUri = request._requestUri();
|
| MD5 hasher = new MD5();
|
| hasher.add(request.method.codeUnits);
|
| hasher.add([_CharCode.COLON]);
|
| - hasher.add(request.uri.path.codeUnits);
|
| + hasher.add(requestUri.codeUnits);
|
| var ha2 = CryptoUtils.bytesToHex(hasher.close());
|
|
|
| String qop;
|
| @@ -2174,7 +2180,7 @@ class _HttpClientDigestCredentials
|
| buffer.write('username="$username"');
|
| buffer.write(', realm="${credentials.realm}"');
|
| buffer.write(', nonce="${credentials.nonce}"');
|
| - buffer.write(', uri="${request.uri.path}"');
|
| + buffer.write(', uri="$requestUri"');
|
| buffer.write(', algorithm="${credentials.algorithm}"');
|
| if (qop == "auth") {
|
| buffer.write(', qop="$qop"');
|
|
|