src/Foundation/Net/Gimela.Net.Http/Messages/Parsers/MessageParser.cs
/// <summary>
/// Parser method to copy all body bytes.
/// </summary>
/// <returns></returns>
/// <remarks>Needed since a TCP packet can contain multiple messages
/// after each other, or partial messages.</remarks>
Parser method to copy all body bytes.
Parser method to copy all body bytes .
private bool GetBody()
    {
      if (_reader.RemainingLength == 0)
        return false;
      if (_reader.RemainingLength >= _bodyBytesLeft)
      {
        OnBodyBytes(_buffer, _reader.Index, _bodyBytesLeft);
        _reader.Index += _bodyBytesLeft;
        _bodyBytesLeft = 0;
        OnComplete();
        return false;
      }
      OnBodyBytes(_buffer, _reader.Index, _reader.RemainingLength);
      _bodyBytesLeft -= _reader.RemainingLength;
      _reader.Index = _reader.Length; 
      return _reader.Index != _reader.Length;
    }
private bool GetBody ( ) { if ( _reader . RemainingLength == 0 ) return false ; if ( _reader . RemainingLength >= _bodyBytesLeft ) { OnBodyBytes ( _buffer , _reader . Index , _bodyBytesLeft ) ; _reader . Index += _bodyBytesLeft ; _bodyBytesLeft = 0 ; OnComplete ( ) ; return false ; } OnBodyBytes ( _buffer , _reader . Index , _reader . RemainingLength ) ; _bodyBytesLeft -= _reader . RemainingLength ; _reader . Index = _reader . Length ; return _reader . Index != _reader . Length ; }
Parser method to copy all body bytes.
Parser method to copy all body bytes .
// Got enough bytes to complete body. // eat remaining bytes. // place it in the end
None
remarks
Needed since a TCP packet can contain multiple messages
after each other, or partial messages.
Needed since a TCP packet can contain multiple messages after each other or partial messages .