Moreover according to RFC2616 header names are subset of ASCII chars [0-127],
so culture-aware comparison is useless and eats too many processor time
(according to my benchmarks get an item from Hashtable with OrdinalIgnoreCase
comparers more than 20x times faster compared to Hashtable with InvariantCultureIgnoreCase
comparer)
{
bool? headerCheckingEnabled;
{
bool? headerCheckingEnabled;
+ public HttpHeaderCollection () : base (StringComparer.OrdinalIgnoreCase)
+ {
+ }
+
bool HeaderCheckingEnabled {
get {
if (headerCheckingEnabled == null)
bool HeaderCheckingEnabled {
get {
if (headerCheckingEnabled == null)
if (headers_sent)
throw new HttpException ("Headers have been already sent");
#if !TARGET_J2EE
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
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
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
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;
}
user_cache_control = value;
return;
}