[Modify] Polish it
This commit is contained in:
parent
131b4ca8c9
commit
697b46a600
@ -540,14 +540,28 @@ namespace WebSocketSharp.Net
|
|||||||
}
|
}
|
||||||
|
|
||||||
set {
|
set {
|
||||||
checkDisposedOrHeadersSent ();
|
if (_disposed)
|
||||||
|
throw new ObjectDisposedException (GetType ().ToString ());
|
||||||
|
|
||||||
|
if (_headersSent) {
|
||||||
|
var msg = "The response is already being sent.";
|
||||||
|
throw new InvalidOperationException (msg);
|
||||||
|
}
|
||||||
|
|
||||||
if (value == null || value.Length == 0) {
|
if (value == null || value.Length == 0) {
|
||||||
_statusDescription = _statusCode.GetStatusDescription ();
|
_statusDescription = _statusCode.GetStatusDescription ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value.IsText () || value.IndexOfAny (new[] { '\r', '\n' }) > -1)
|
if (!value.IsText ()) {
|
||||||
throw new ArgumentException ("Contains invalid characters.", "value");
|
var msg = "It contains invalid characters.";
|
||||||
|
throw new ArgumentException (msg, "value");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.IndexOfAny (new[] { '\r', '\n' }) > -1) {
|
||||||
|
var msg = "It contains invalid characters.";
|
||||||
|
throw new ArgumentException (msg, "value");
|
||||||
|
}
|
||||||
|
|
||||||
_statusDescription = value;
|
_statusDescription = value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user