diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index c27bdbe9..2920dcaf 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -3866,26 +3866,23 @@ namespace WebSocketSharp throw new InvalidOperationException (msg); } - if (url == null) - throw new ArgumentNullException ("url"); + Uri uri = null; - if (url.Length == 0) - throw new ArgumentException ("An empty string.", "url"); + if (!url.IsNullOrEmpty ()) { + if (!Uri.TryCreate (url, UriKind.Absolute, out uri)) { + msg = "Not an absolute URI string."; + throw new ArgumentException (msg, "url"); + } - Uri uri; - if (!Uri.TryCreate (url, UriKind.Absolute, out uri)) { - msg = "Not an absolute URI string."; - throw new ArgumentException (msg, "url"); - } + if (uri.Scheme != "http") { + msg = "The scheme part is not http."; + throw new ArgumentException (msg, "url"); + } - if (uri.Scheme != "http") { - msg = "The scheme part is not http."; - throw new ArgumentException (msg, "url"); - } - - if (uri.Segments.Length > 1) { - msg = "It includes the path segments."; - throw new ArgumentException (msg, "url"); + if (uri.Segments.Length > 1) { + msg = "It includes the path segments."; + throw new ArgumentException (msg, "url"); + } } if (!username.IsNullOrEmpty ()) { @@ -3913,6 +3910,13 @@ namespace WebSocketSharp return; } + if (url.IsNullOrEmpty ()) { + _proxyUri = null; + _proxyCredentials = null; + + return; + } + _proxyUri = uri; _proxyCredentials = !username.IsNullOrEmpty () ? new NetworkCredential (