React to IHeaderDictionary changes.

This commit is contained in:
Chris R 2015-10-12 09:29:34 -07:00
parent 3eec43a0c3
commit cfe6e22a29
3 changed files with 22 additions and 7 deletions

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.Extensions.Primitives;
@ -145,7 +146,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
}
}
IDictionary<string, StringValues> IHttpRequestFeature.Headers
IHeaderDictionary IHttpRequestFeature.Headers
{
get
{
@ -197,7 +198,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
}
}
IDictionary<string, StringValues> IHttpResponseFeature.Headers
IHeaderDictionary IHttpResponseFeature.Headers
{
get
{

View File

@ -2,14 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Server.Kestrel.Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;
@ -55,13 +54,13 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
public string Path { get; set; }
public string QueryString { get; set; }
public string HttpVersion { get; set; }
public IDictionary<string, StringValues> RequestHeaders { get; set; }
public IHeaderDictionary RequestHeaders { get; set; }
public MessageBody MessageBody { get; set; }
public Stream RequestBody { get; set; }
public int StatusCode { get; set; }
public string ReasonPhrase { get; set; }
public IDictionary<string, StringValues> ResponseHeaders { get; set; }
public IHeaderDictionary ResponseHeaders { get; set; }
public Stream ResponseBody { get; set; }
public Stream DuplexStream { get; set; }

View File

@ -5,16 +5,31 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNet.Server.Kestrel.Http
{
public abstract class FrameHeaders : IDictionary<string, StringValues>
public abstract class FrameHeaders : IHeaderDictionary
{
protected Dictionary<string, StringValues> MaybeUnknown;
protected Dictionary<string, StringValues> Unknown => MaybeUnknown ?? (MaybeUnknown = new Dictionary<string, StringValues>(StringComparer.OrdinalIgnoreCase));
StringValues IHeaderDictionary.this[string key]
{
get
{
StringValues value;
TryGetValueFast(key, out value);
return value;
}
set
{
SetValueFast(key, value);
}
}
StringValues IDictionary<string, StringValues>.this[string key]
{
get