[Modify] Polish it
This commit is contained in:
parent
d3c92a8a02
commit
805d547480
@ -455,6 +455,7 @@ Extended Payload Length: {7}
|
|||||||
{
|
{
|
||||||
if (header.Length != 2) {
|
if (header.Length != 2) {
|
||||||
var msg = "The header part of a frame could not be read.";
|
var msg = "The header part of a frame could not be read.";
|
||||||
|
|
||||||
throw new WebSocketException (msg);
|
throw new WebSocketException (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,22 +482,26 @@ Extended Payload Length: {7}
|
|||||||
|
|
||||||
if (!opcode.IsSupported ()) {
|
if (!opcode.IsSupported ()) {
|
||||||
var msg = "A frame has an unsupported opcode.";
|
var msg = "A frame has an unsupported opcode.";
|
||||||
|
|
||||||
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opcode.IsData () && rsv1 == Rsv.On) {
|
if (!opcode.IsData () && rsv1 == Rsv.On) {
|
||||||
var msg = "A non data frame is compressed.";
|
var msg = "A non data frame is compressed.";
|
||||||
|
|
||||||
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opcode.IsControl ()) {
|
if (opcode.IsControl ()) {
|
||||||
if (fin == Fin.More) {
|
if (fin == Fin.More) {
|
||||||
var msg = "A control frame is fragmented.";
|
var msg = "A control frame is fragmented.";
|
||||||
|
|
||||||
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payloadLen > 125) {
|
if (payloadLen > 125) {
|
||||||
var msg = "A control frame has too long payload length.";
|
var msg = "A control frame has too long payload length.";
|
||||||
|
|
||||||
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user