protected void ParseHeaderBlock(Byte[] compressedData, int headerBlockOffset) { // Decompress data var data = SPDYFrameDecompressor.Instance.Decompress(compressedData, headerBlockOffset); // zlib.net library still contains bug which can result in invalid decompressed data var fieldCount = SPDYFrameBase.ReadInt(data, 0, 4); var readedBytes = 4; for (var i = 0; i < fieldCount && readedBytes < data.Length; i++) { // Read name var nameLen = SPDYFrameBase.ReadInt(data, readedBytes, 4); readedBytes += 4; var name = Encoding.ASCII.GetString(data, readedBytes, nameLen); readedBytes += nameLen; //Read value var valueLen = SPDYFrameBase.ReadInt(data, readedBytes, 4); readedBytes += 4; var value = Encoding.ASCII.GetString(data, readedBytes, valueLen); readedBytes += valueLen; this.Fields[name] = value; } }
protected SPDYStreamFrame(Byte[] header, Byte[] data) : base(header) { this.Fields = new Dictionary <string, string>(); this.StreamID = SPDYFrameBase.ReadInt(data, 0, 4) & 0x7fffffff; this.ParseHeaderBlock(data, this.HeaderBlockOffset); }
public SPDYFrameData(Byte[] header, Byte[] data) : base(header) { this.StreamID = SPDYFrameBase.ReadInt(header, 0, 4) & 0x7fffffff; this.Data = data; }
protected SPDYControlFrame(Byte[] header) : base(header) { this.Version = SPDYFrameBase.ReadInt(header, 0, 2) & 0x7fff; }