[Modify] Polish it

To initialize.
This commit is contained in:
sta 2017-11-13 15:08:56 +09:00
parent 0d3be42f00
commit fdfc127530

View File

@ -3866,13 +3866,9 @@ namespace WebSocketSharp
throw new InvalidOperationException (msg); throw new InvalidOperationException (msg);
} }
if (url == null) Uri uri = null;
throw new ArgumentNullException ("url");
if (url.Length == 0) if (!url.IsNullOrEmpty ()) {
throw new ArgumentException ("An empty string.", "url");
Uri uri;
if (!Uri.TryCreate (url, UriKind.Absolute, out uri)) { if (!Uri.TryCreate (url, UriKind.Absolute, out uri)) {
msg = "Not an absolute URI string."; msg = "Not an absolute URI string.";
throw new ArgumentException (msg, "url"); throw new ArgumentException (msg, "url");
@ -3887,6 +3883,7 @@ namespace WebSocketSharp
msg = "It includes the path segments."; msg = "It includes the path segments.";
throw new ArgumentException (msg, "url"); throw new ArgumentException (msg, "url");
} }
}
if (!username.IsNullOrEmpty ()) { if (!username.IsNullOrEmpty ()) {
if (username.Contains (':') || !username.IsText ()) { if (username.Contains (':') || !username.IsText ()) {
@ -3913,6 +3910,13 @@ namespace WebSocketSharp
return; return;
} }
if (url.IsNullOrEmpty ()) {
_proxyUri = null;
_proxyCredentials = null;
return;
}
_proxyUri = uri; _proxyUri = uri;
_proxyCredentials = !username.IsNullOrEmpty () _proxyCredentials = !username.IsNullOrEmpty ()
? new NetworkCredential ( ? new NetworkCredential (