Esempio n. 1
0
            public override IHeaders <AsciiString, ICharSequence> Add(IHeaders <AsciiString, ICharSequence> headers)
            {
                // Override the fast-copy mechanism used by DefaultHeaders
                if (ReferenceEquals(headers, this))
                {
                    ThrowHelper.ThrowArgumentException_HeadCantAddSelf();
                }

                if (headers is CombinedHttpHeadersImpl)
                {
                    if (this.IsEmpty)
                    {
                        // Can use the fast underlying copy
                        this.AddImpl(headers);
                    }
                    else
                    {
                        // Values are already escaped so don't escape again
                        foreach (HeaderEntry <AsciiString, ICharSequence> header in headers)
                        {
                            _ = this.AddEscapedValue(header.Key, header.Value);
                        }
                    }
                }
                else
                {
                    foreach (HeaderEntry <AsciiString, ICharSequence> header in headers)
                    {
                        _ = this.Add(header.Key, header.Value);
                    }
                }

                return(this);
            }