[Modify] Polish it
This commit is contained in:
parent
fa470026cb
commit
642dd28b61
@ -162,11 +162,15 @@ namespace WebSocketSharp.Net
|
|||||||
return InputChunkState.None;
|
return InputChunkState.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputChunkState setChunkSize (byte[] buffer, ref int offset, int length)
|
private InputChunkState setChunkSize (
|
||||||
|
byte[] buffer, ref int offset, int length
|
||||||
|
)
|
||||||
{
|
{
|
||||||
byte b = 0;
|
byte b = 0;
|
||||||
|
|
||||||
while (offset < length) {
|
while (offset < length) {
|
||||||
b = buffer[offset++];
|
b = buffer[offset++];
|
||||||
|
|
||||||
if (_sawCr) {
|
if (_sawCr) {
|
||||||
if (b != 10)
|
if (b != 10)
|
||||||
throwProtocolViolation ("LF is expected.");
|
throwProtocolViolation ("LF is expected.");
|
||||||
@ -176,6 +180,7 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
if (b == 13) {
|
if (b == 13) {
|
||||||
_sawCr = true;
|
_sawCr = true;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,9 +201,12 @@ namespace WebSocketSharp.Net
|
|||||||
return InputChunkState.None;
|
return InputChunkState.None;
|
||||||
|
|
||||||
_chunkRead = 0;
|
_chunkRead = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_chunkSize = Int32.Parse (
|
_chunkSize = Int32.Parse (
|
||||||
removeChunkExtension (_saved.ToString ()), NumberStyles.HexNumber);
|
removeChunkExtension (_saved.ToString ()),
|
||||||
|
NumberStyles.HexNumber
|
||||||
|
);
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
throwProtocolViolation ("The chunk size cannot be parsed.");
|
throwProtocolViolation ("The chunk size cannot be parsed.");
|
||||||
@ -206,6 +214,7 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
if (_chunkSize == 0) {
|
if (_chunkSize == 0) {
|
||||||
_trailerState = 2;
|
_trailerState = 2;
|
||||||
|
|
||||||
return InputChunkState.Trailer;
|
return InputChunkState.Trailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user