Chromium Code Reviews| Index: sdk/lib/io/websocket_impl.dart |
| diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart |
| index ae4c91ce6208f76e2d346c701f2e5fe0831a2786..cdaa3a0e448f5be006824667bb9078ce5a2b3cc4 100644 |
| --- a/sdk/lib/io/websocket_impl.dart |
| +++ b/sdk/lib/io/websocket_impl.dart |
| @@ -775,9 +775,6 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket { |
| if (uri.scheme != "ws" && uri.scheme != "wss") { |
| throw new WebSocketException("Unsupported URL scheme '${uri.scheme}'"); |
| } |
| - if (uri.userInfo != "") { |
| - throw new WebSocketException("Unsupported user info '${uri.userInfo}'"); |
| - } |
| Random random = new Random(); |
| // Generate 16 random bytes. |
| @@ -809,6 +806,13 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket { |
| if (protocols != null) { |
| request.headers.add("Sec-WebSocket-Protocol", protocols.toList()); |
| } |
| + if (uri.userInfo != null && !uri.userInfo.isEmpty) { |
| + // If the URL contains user information use that for basic |
| + // authorization. |
| + String auth = |
| + _CryptoUtils.bytesToBase64(UTF8.encode(uri.userInfo)); |
| + request.headers.set(HttpHeaders.AUTHORIZATION, "Basic $auth"); |
| + } |
|
kustermann
2015/02/06 13:13:46
Maybe move this before the `if (headers != null) {
Søren Gjesse
2015/02/09 10:38:59
Good point, done.
|
| return request.close(); |
| }) |
| .then((response) { |