[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,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 (