You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a bug in your SimpleWebSocketServer.
Class WebSocketHttpServer, function RunServer
buffer is to small when headers contains cookies
I propose this version for reading headers :
`...
byte[] temp = new byte[maxRead];
byte[] buffer= new byte[maxRead];
int bytesRead;
int totalBytes = 0;
while ((bytesRead=await stream.ReadAsync(temp, 0, maxRead))>0)
{
System.Array.Copy(temp, 0, buffer, totalBytes, bytesRead);
totalBytes += bytesRead;
if (stream.DataAvailable)
System.Array.Resize(ref buffer, totalBytes+bytesRead);
else
break;
}
string received = Encoding.UTF8.GetString(buffer, 0, totalBytes);
....`
regards
Nicolas
The text was updated successfully, but these errors were encountered:
Hi
I found a bug in your SimpleWebSocketServer.
Class WebSocketHttpServer, function RunServer
buffer is to small when headers contains cookies
I propose this version for reading headers :
`...
byte[] temp = new byte[maxRead];
byte[] buffer= new byte[maxRead];
int bytesRead;
int totalBytes = 0;
while ((bytesRead=await stream.ReadAsync(temp, 0, maxRead))>0)
{
System.Array.Copy(temp, 0, buffer, totalBytes, bytesRead);
totalBytes += bytesRead;
if (stream.DataAvailable)
System.Array.Resize(ref buffer, totalBytes+bytesRead);
else
break;
}
string received = Encoding.UTF8.GetString(buffer, 0, totalBytes);
....`
regards
Nicolas
The text was updated successfully, but these errors were encountered: