Esempio n. 1
0
 public void Finish()
 {
     if (_exceededMaxLength)
     {
         Http2CodecUtil.HeaderListSizeExceeded(_streamId, _maxHeaderListSize, true);
     }
     else if (_validationException is object)
     {
         ThrowValidationException();
     }
 }
Esempio n. 2
0
        void EncodeHeadersEnforceMaxHeaderListSize(int streamId, IByteBuffer output, IHttp2Headers headers, ISensitivityDetector sensitivityDetector)
        {
            long headerSize = 0;

            // To ensure we stay consistent with our peer check the size is valid before we potentially modify HPACK state.
            foreach (HeaderEntry <ICharSequence, ICharSequence> header in headers)
            {
                ICharSequence name  = header.Key;
                ICharSequence value = header.Value;
                // OK to increment now and check for bounds after because this value is limited to unsigned int and will not
                // overflow.
                headerSize += HpackHeaderField.SizeOf(name, value);
                if (headerSize > _maxHeaderListSize)
                {
                    Http2CodecUtil.HeaderListSizeExceeded(streamId, _maxHeaderListSize, false);
                }
            }

            EncodeHeadersIgnoreMaxHeaderListSize(@output, headers, sensitivityDetector);
        }
Esempio n. 3
0
 /// <summary>
 /// The local header size maximum has been exceeded while accumulating bytes.
 /// </summary>
 /// <exception cref="Http2Exception">A connection error indicating too much data has been received.</exception>
 void HeaderSizeExceeded()
 {
     Close();
     Http2CodecUtil.HeaderListSizeExceeded(_reader._headersDecoder.Configuration.MaxHeaderListSizeGoAway);
 }