private void HandleReceivingResponseLine(string line)
{
byte[] bytes;
bytes = ReadNextBytes(line, _receivingResponseRegex);
if (bytes != null)
{
if (_currentRequestData == null || _currentHeader == null)
{
//this is a situation where we have a response without a request
return;
}
_currentRequestData.AddToResponse(bytes);
if (String.IsNullOrEmpty(_currentHeader.ResponseStatus))
{
//check if we have the full response line
MemoryStream ms = new MemoryStream(_currentRequestData.RawResponse);
byte[] respLineBytes = Utils.ReadLine(ms, ESTIMATED_LINE_SIZE);
string respLine = Utils.ByteToString(respLineBytes);
if (_lineTypeSelector.GetLineType(respLine) == LineType.FirstResponseLine)
{
HandleFirstResponseLine(respLine, null);
}
}
}
}