[Modify] Polish it
This commit is contained in:
parent
11b6f169ec
commit
f4f101384a
@ -931,12 +931,22 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public void Redirect (string url)
|
public void Redirect (string url)
|
||||||
{
|
{
|
||||||
checkDisposedOrHeadersSent ();
|
if (_disposed)
|
||||||
|
throw new ObjectDisposedException (GetType ().ToString ());
|
||||||
|
|
||||||
|
if (_headersSent) {
|
||||||
|
var msg = "The response is already being sent.";
|
||||||
|
throw new InvalidOperationException (msg);
|
||||||
|
}
|
||||||
|
|
||||||
if (url == null)
|
if (url == null)
|
||||||
throw new ArgumentNullException ("url");
|
throw new ArgumentNullException ("url");
|
||||||
|
|
||||||
Uri uri = null;
|
if (!url.MaybeUri ())
|
||||||
if (!url.MaybeUri () || !Uri.TryCreate (url, UriKind.Absolute, out uri))
|
throw new ArgumentException ("Not an absolute URL.", "url");
|
||||||
|
|
||||||
|
Uri uri;
|
||||||
|
if (!Uri.TryCreate (url, UriKind.Absolute, out uri))
|
||||||
throw new ArgumentException ("Not an absolute URL.", "url");
|
throw new ArgumentException ("Not an absolute URL.", "url");
|
||||||
|
|
||||||
_location = url;
|
_location = url;
|
||||||
|
Loading…
Reference in New Issue
Block a user