[Modify] Polish it

This commit is contained in:
sta 2020-11-01 17:37:07 +09:00
parent a1d396490d
commit 60adfd7362

View File

@ -371,14 +371,16 @@ namespace WebSocketSharp.Net
if (_currentLine == null) if (_currentLine == null)
_currentLine = new StringBuilder (64); _currentLine = new StringBuilder (64);
var nread = 0;
try { try {
string line; while (true) {
int nread;
var line = readLineFrom (data, _position, length, out nread);
while ((line = readLineFrom (data, _position, length, out nread)) != null) {
_position += nread; _position += nread;
if (line == null)
break;
if (line.Length == 0) { if (line.Length == 0) {
if (_inputState == InputState.RequestLine) if (_inputState == InputState.RequestLine)
continue; continue;
@ -409,8 +411,6 @@ namespace WebSocketSharp.Net
return true; return true;
} }
_position += nread;
if (_position >= 32768) { if (_position >= 32768) {
_context.ErrorMessage = "Headers too long"; _context.ErrorMessage = "Headers too long";