|
|
|
@ -374,8 +374,10 @@ namespace WebSocketSharp.Net
|
|
|
|
private string readLineFrom (byte[] buffer, int offset, int length, out int read)
|
|
|
|
private string readLineFrom (byte[] buffer, int offset, int length, out int read)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
read = 0;
|
|
|
|
read = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = offset; i < length && _lineState != LineState.Lf; i++) {
|
|
|
|
for (var i = offset; i < length && _lineState != LineState.Lf; i++) {
|
|
|
|
read++;
|
|
|
|
read++;
|
|
|
|
|
|
|
|
|
|
|
|
var b = buffer[i];
|
|
|
|
var b = buffer[i];
|
|
|
|
if (b == 13)
|
|
|
|
if (b == 13)
|
|
|
|
_lineState = LineState.Cr;
|
|
|
|
_lineState = LineState.Cr;
|
|
|
|
@ -385,17 +387,17 @@ namespace WebSocketSharp.Net
|
|
|
|
_currentLine.Append ((char) b);
|
|
|
|
_currentLine.Append ((char) b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_lineState == LineState.Lf) {
|
|
|
|
if (_lineState != LineState.Lf)
|
|
|
|
_lineState = LineState.None;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
var line = _currentLine.ToString ();
|
|
|
|
var line = _currentLine.ToString ();
|
|
|
|
|
|
|
|
|
|
|
|
_currentLine.Length = 0;
|
|
|
|
_currentLine.Length = 0;
|
|
|
|
|
|
|
|
_lineState = LineState.None;
|
|
|
|
|
|
|
|
|
|
|
|
return line;
|
|
|
|
return line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void removeConnection ()
|
|
|
|
private void removeConnection ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_lastListener != null)
|
|
|
|
if (_lastListener != null)
|
|
|
|
|