public HeadersList Decompress(byte[] serializedHeaders) { try { var workingSet = new HeadersList(_localRefSet); var unindexedHeadersList = new HeadersList(); _currentOffset = 0; while (_currentOffset != serializedHeaders.Length) { var entry = ParseHeader(serializedHeaders); var header = new KeyValuePair<string, string>(entry.Item1, entry.Item2); if (entry.Item3 == IndexationType.Indexed) { if (workingSet.Contains(header)) workingSet.RemoveAll(h => h.Equals(header)); else workingSet.Add(header); } else if (entry.Item3 == IndexationType.WithoutIndexation) { unindexedHeadersList.Add(header); } else { workingSet.Add(header); } } _localRefSet = new HeadersList(workingSet); for (int i = _localRefSet.Count - 1; i >= 0; --i) { var header = _localRefSet[i]; if (!_localHeaderTable.Contains(header)) _localRefSet.RemoveAll(h => h.Equals(header)); } workingSet.AddRange(unindexedHeadersList); return workingSet; } catch (Exception e) { throw new CompressionError(e); } }