Ejemplo n.º 1
0
 public Http2AltsvcFrame(Http2FrameHeader header, byte[] origin, byte[] altSvcFieldValue)
 {
     this.Header           = header;
     this.OriginLen        = (ushort)origin.Length;
     this.Origin           = origin;
     this.AltSvcFieldValue = altSvcFieldValue;
 }
Ejemplo n.º 2
0
 public Http2PriorityFrame(Http2FrameHeader header, bool e, int streamDependencyID, byte weight)
 {
     this.Header             = header;
     this.E                  = e;
     this.StreamDependencyID = streamDependencyID;
     this.Weight             = weight;
 }
Ejemplo n.º 3
0
 public Http2GoawayFrame(Http2FrameHeader header, int lastStreamID, Http2ErrorCode errorCode, byte[] additionalDebugData)
 {
     this.Header              = header;
     this.R                   = false;
     this.LastStreamID        = lastStreamID;
     this.ErrorCode           = errorCode;
     this.AdditionalDebugData = additionalDebugData;
 }
Ejemplo n.º 4
0
 public Http2RstStreamFrame(Http2FrameHeader header, byte[] data)
 {
     if (data.Length != header.Length)
     {
         throw new ArgumentException("Invalid Length.");
     }
     this.Header    = header;
     this.ErrorCode = (Http2ErrorCode)data.ToUInt32(0);
 }
Ejemplo n.º 5
0
 public Http2PingFrame(Http2FrameHeader header, byte[] data)
 {
     if (data.Length != header.Length)
     {
         throw new ArgumentException("Invalid Length.");
     }
     this.Header     = header;
     this.OpaqueData = data;
 }
Ejemplo n.º 6
0
 public Http2ContinuationFrame(Http2FrameHeader header, byte[] data)
 {
     if (data.Length != header.Length)
     {
         throw new ArgumentException("Invalid Length.");
     }
     this.Header = header;
     this.HeaderBlockFragment = data;
 }
Ejemplo n.º 7
0
 public Http2WindowUpdateFrame(Http2FrameHeader header, byte[] data)
 {
     if (data.Length != header.Length)
     {
         throw new ArgumentException("Invalid Length.");
     }
     this.Header = header;
     this.R      = data[0].HasFlag(0b10000000);
     this.WindowSizeIncrement = data.ToUInt31(0);
 }
Ejemplo n.º 8
0
 public Http2AltsvcFrame(Http2FrameHeader header, byte[] data)
 {
     if (data.Length != header.Length)
     {
         throw new ArgumentException("Invalid Length.");
     }
     this.Header           = header;
     this.OriginLen        = data.ToUInt16(0);
     this.Origin           = data.Skip(2).Take(this.OriginLen).ToArray();
     this.AltSvcFieldValue = data.Skip(2 + this.OriginLen).ToArray();
 }
Ejemplo n.º 9
0
 public Http2PriorityFrame(Http2FrameHeader header, byte[] data)
 {
     if (data.Length != header.Length)
     {
         throw new ArgumentException("Invalid Length.");
     }
     this.Header             = header;
     this.E                  = data[0].HasFlag(0b10000000);
     this.StreamDependencyID = data.ToUInt31(0);
     this.Weight             = data[4];
 }
Ejemplo n.º 10
0
        public static Http2RstStreamFrame Create(
            int streamID,
            Http2ErrorCode errorCode)
        {
            var header = new Http2FrameHeader(
                4,
                Http2FrameType.RstStream,
                0,
                streamID);

            return(new Http2RstStreamFrame(header, errorCode));
        }
Ejemplo n.º 11
0
 public Http2GoawayFrame(Http2FrameHeader header, byte[] data)
 {
     if (data.Length != header.Length)
     {
         throw new ArgumentException("Invalid Length.");
     }
     this.Header              = header;
     this.R                   = data[0].HasFlag(0b10000000);
     this.LastStreamID        = data.ToUInt31(0);
     this.ErrorCode           = (Http2ErrorCode)data.ToUInt32(4);
     this.AdditionalDebugData = data.Skip(8).ToArray();
 }
Ejemplo n.º 12
0
        public static Http2GoawayFrame Create(
            int streamID,
            int lastStreamID,
            Http2ErrorCode errorCode,
            byte[] additionalDebugData)
        {
            var header = new Http2FrameHeader(
                4 + 4 + additionalDebugData.Length,
                Http2FrameType.Goaway,
                0,
                streamID);

            return(new Http2GoawayFrame(header, lastStreamID, errorCode, additionalDebugData));
        }
Ejemplo n.º 13
0
        public static Http2ContinuationFrame Create(
            int streamID,
            bool isEndHeaders,
            byte[] headerBlockFragment)
        {
            var flags  = isEndHeaders ? (byte)Flag.EndHeaders : (byte)0;
            var header = new Http2FrameHeader(
                headerBlockFragment.Length,
                Http2FrameType.Continuation,
                flags,
                streamID);

            return(new Http2ContinuationFrame(header, headerBlockFragment));
        }
Ejemplo n.º 14
0
        public Http2OriginFrame(Http2FrameHeader header, byte[] data)
        {
            if (data.Length != header.Length)
            {
                throw new ArgumentException("Invalid Length.");
            }
            this.Header = header;

            var entries = new List <OriginEntry>();
            var index   = 0;

            while (index < data.Length)
            {
                var entry = new OriginEntry();
                entry.OriginLen   = data.ToUInt16(index);
                index            += 2;
                entry.AsciiOrigin = data.Skip(index).Take(entry.OriginLen).ToArray();
                index            += entry.OriginLen;
                entries.Add(entry);
            }
            this.OriginEntries = entries;
        }
Ejemplo n.º 15
0
 public Http2OriginFrame(Http2FrameHeader header, IReadOnlyList <OriginEntry> originEntries)
 {
     this.Header        = header;
     this.OriginEntries = originEntries;
 }
Ejemplo n.º 16
0
 public Http2RstStreamFrame(Http2FrameHeader header, Http2ErrorCode errorCode)
 {
     this.Header    = header;
     this.ErrorCode = errorCode;
 }
Ejemplo n.º 17
0
 public Http2UnknownFrame(Http2FrameHeader header, byte[] data)
 {
     this.Header  = header;
     this.Payload = data;
 }