Skip to content

Commit

Permalink
Merge pull request #832 from xplicit/webperf1
Browse files Browse the repository at this point in the history
Header names should be compared binary but not linguistic.
  • Loading branch information
kumpera committed Dec 13, 2013
2 parents f6e4c12 + 583e8e0 commit 7ea732a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions mcs/class/System.Web/System.Web/HttpHeaderCollection.cs
Expand Up @@ -34,6 +34,10 @@ sealed class HttpHeaderCollection : NameValueCollection
{
bool? headerCheckingEnabled;

public HttpHeaderCollection () : base (StringComparer.OrdinalIgnoreCase)
{
}

bool HeaderCheckingEnabled {
get {
if (headerCheckingEnabled == null)
Expand Down
8 changes: 4 additions & 4 deletions mcs/class/System.Web/System.Web/HttpResponse.cs
Expand Up @@ -510,27 +510,27 @@ public void AppendHeader (string name, string value)
if (headers_sent)
throw new HttpException ("Headers have been already sent");
#if !TARGET_J2EE
if (String.Compare (name, "content-length", true, Helpers.InvariantCulture) == 0){
if (String.Compare (name, "content-length", StringComparison.OrdinalIgnoreCase) == 0){
content_length = (long) UInt64.Parse (value);
use_chunked = false;
return;
}
#endif

if (String.Compare (name, "content-type", true, Helpers.InvariantCulture) == 0){
if (String.Compare (name, "content-type", StringComparison.OrdinalIgnoreCase) == 0){
ContentType = value;
return;
}

#if !TARGET_J2EE
if (String.Compare (name, "transfer-encoding", true, Helpers.InvariantCulture) == 0){
if (String.Compare (name, "transfer-encoding", StringComparison.OrdinalIgnoreCase) == 0){
transfer_encoding = value;
use_chunked = false;
return;
}
#endif

if (String.Compare (name, "cache-control", true, Helpers.InvariantCulture) == 0){
if (String.Compare (name, "cache-control", StringComparison.OrdinalIgnoreCase) == 0){
user_cache_control = value;
return;
}
Expand Down

0 comments on commit 7ea732a

Please sign in to comment.