@@ -47,7 +47,7 @@ public bool IsContentEncodingAcceptable(CachedVary cachedVary, HttpRawResponse r
4747 if ( headers == null ) {
4848 return IsAcceptableEncoding ( null , acceptEncoding ) ;
4949 }
50- string contentEncoding = headers . Cast < string > ( ) . FirstOrDefault ( h => h == HttpHeaders . ContentEncoding ) ;
50+ string contentEncoding = headers . Cast < string > ( ) . FirstOrDefault ( h => h . Equals ( HttpHeaders . ContentEncoding , StringComparison . OrdinalIgnoreCase ) ) ;
5151 return IsAcceptableEncoding ( contentEncoding , acceptEncoding ) ;
5252 }
5353
@@ -64,7 +64,7 @@ public bool CheckHeaders(HttpCachePolicySettings settings) {
6464 if ( pragma == null ) {
6565 return false ;
6666 }
67- if ( ! pragma . Split ( s_fieldSeparators ) . Any ( t => t == null || t == CacheDirectives . NoCache ) ) {
67+ if ( ! pragma . Split ( s_fieldSeparators ) . Any ( t => t == null || t . Equals ( CacheDirectives . NoCache , StringComparison . OrdinalIgnoreCase ) ) ) {
6868 return false ;
6969 }
7070 return true ;
@@ -180,7 +180,7 @@ public bool CheckCachedVary(CachedVary cachedVary, HttpCachePolicySettings setti
180180 // From this point on, we have an entry to work with.
181181 if ( cachedVary == null && ! settings . IgnoreParams ) {
182182 // This cached output has no vary policy, so make sure it doesn't have a query string or form post.
183- if ( request . HttpMethod == HttpMethods . POST ) {
183+ if ( request . HttpMethod . Equals ( HttpMethods . POST , StringComparison . OrdinalIgnoreCase ) ) {
184184 return true ;
185185 }
186186 if ( request . QueryString . Count > 0 ) {
@@ -245,7 +245,7 @@ public int GetAcceptableEncoding(string[] contentEncodings, int startIndex, stri
245245 acceptEncodingWithoutWeight = acceptEncoding . Substring ( 0 , tokenEnd ) ;
246246 if ( ParseWeight ( acceptEncoding , tokenEnd ) == 0 ) {
247247 //weight is 0, use "identity" only if it is acceptable
248- bool identityIsAcceptable = acceptEncodingWithoutWeight != Identity &&
248+ bool identityIsAcceptable = ! acceptEncodingWithoutWeight . Equals ( Identity , StringComparison . OrdinalIgnoreCase ) &&
249249 acceptEncodingWithoutWeight != Asterisk ;
250250 return ( identityIsAcceptable ) ? - 1 : - 2 ;
251251 }
@@ -294,7 +294,7 @@ public bool IsAcceptableEncoding(string contentEncoding, string acceptEncoding)
294294 }
295295 if ( string . IsNullOrEmpty ( acceptEncoding ) ) {
296296 // only the identity is acceptable if Accept-Encoding is not set
297- return ( contentEncoding == Identity ) ;
297+ return ( contentEncoding . Equals ( Identity , StringComparison . OrdinalIgnoreCase ) ) ;
298298 }
299299 double weight = GetAcceptableEncodingHelper ( contentEncoding , acceptEncoding ) ;
300300 return ! ( weight == 0 ) &&
@@ -343,7 +343,7 @@ public bool IsResponseCacheable() {
343343 bool acceptParams = ( cache . VaryByParams . IgnoreParams ||
344344 ( Equals ( cache . VaryByParams . GetParams ( ) , new [ ] { Asterisk } ) ) ||
345345 ( cache . VaryByParams . GetParams ( ) != null && cache . VaryByParams . GetParams ( ) . Any ( ) ) ) ;
346- if ( ! acceptParams && ( request . HttpMethod == HttpMethods . POST || ( request . QueryString . Count > 0 ) ) ) {
346+ if ( ! acceptParams && ( request . HttpMethod . Equals ( HttpMethods . POST , StringComparison . OrdinalIgnoreCase ) || ( request . QueryString . Count > 0 ) ) ) {
347347 return false ;
348348 }
349349 return cache . VaryByContentEncodings . GetContentEncodings ( ) == null ||
@@ -452,7 +452,7 @@ public void UpdateCachedResponse(HttpCachePolicySettings settings, HttpRawRespon
452452 // Check and see if the cachedRawResponse is from the disk
453453 // If so, we must clone the HttpRawResponse before sending it
454454 // UseSnapshot calls ClearAll
455- UseSnapshot ( rawResponse , request . HttpMethod != "HEAD" ) ;
455+ UseSnapshot ( rawResponse , ! request . HttpMethod . Equals ( "HEAD" , StringComparison . OrdinalIgnoreCase ) ) ;
456456 }
457457 ResetFromHttpCachePolicySettings ( settings , context . Timestamp ) ;
458458 }
@@ -499,7 +499,7 @@ private bool HasDependencyChanged(string depKey, string[] fileDeps, string kerne
499499 int idStartIndex = OutputcacheKeyprefixDependencies . Length ;
500500 int idLength = depKey . Length - idStartIndex ;
501501 // have the file dependencies changed?
502- if ( string . Compare ( dep . GetUniqueID ( ) , 0 , depKey , idStartIndex , idLength , StringComparison . Ordinal ) == 0 ) {
502+ if ( string . Compare ( dep . GetUniqueID ( ) , 0 , depKey , idStartIndex , idLength , StringComparison . OrdinalIgnoreCase ) == 0 ) {
503503 // file dependencies have not changed--cache them with callback to remove OutputCacheEntry if they change
504504 var dce = new DependencyCacheEntry {
505505 RawResponseKey = oceKey ,
@@ -628,7 +628,7 @@ private bool IsCacheableEncoding(Encoding contentEncoding, HttpCacheVaryByConten
628628 return true ;
629629 }
630630 // return true if there is no Content-Encoding header or the Content-Encoding header is listed
631- return contentEncoding == null || varyByContentEncodings . GetContentEncodings ( ) . Any ( varyByContentEncoding => varyByContentEncoding == contentEncoding . ToString ( ) ) ;
631+ return contentEncoding == null || varyByContentEncodings . GetContentEncodings ( ) . Any ( varyByContentEncoding => varyByContentEncoding . Equals ( contentEncoding . ToString ( ) , StringComparison . OrdinalIgnoreCase ) ) ;
632632 }
633633
634634 private bool ContainsNonShareableCookies ( ) {
@@ -818,7 +818,7 @@ private DateTime UpdateLastModifiedTimeFromDependency(CacheDependency dep) {
818818 }
819819
820820 private string CreateOutputCachedItemKey ( string path , string verb , CachedVary cachedVary ) {
821- StringBuilder sb = verb == HttpMethods . POST
821+ StringBuilder sb = verb . Equals ( HttpMethods . POST , StringComparison . OrdinalIgnoreCase )
822822 ? new StringBuilder ( OutputcacheKeyprefixPost , path . Length + OutputcacheKeyprefixPost . Length )
823823 : new StringBuilder ( OutputcacheKeyprefixGet , path . Length + OutputcacheKeyprefixGet . Length ) ;
824824 sb . Append ( CultureInfo . InvariantCulture . TextInfo . ToLower ( path ) ) ;
@@ -851,7 +851,7 @@ private string CreateOutputCachedItemKey(string path, string verb, CachedVary ca
851851 break ;
852852 default :
853853 sb . Append ( "F" ) ;
854- if ( verb == HttpMethods . POST ) {
854+ if ( verb . Equals ( HttpMethods . POST , StringComparison . OrdinalIgnoreCase ) ) {
855855 a = cachedVary . Params ;
856856 if ( ( a != null || cachedVary . VaryByAllParams ) ) {
857857 col = request . Form ;
@@ -904,7 +904,7 @@ private string CreateOutputCachedItemKey(string path, string verb, CachedVary ca
904904 * part of the key.
905905 */
906906 sb . Append ( "D" ) ;
907- if ( verb == HttpMethods . POST &&
907+ if ( verb . Equals ( HttpMethods . POST , StringComparison . OrdinalIgnoreCase ) &&
908908 cachedVary . VaryByAllParams &&
909909 request . Form . Count == 0 ) {
910910
@@ -931,7 +931,7 @@ private string CreateOutputCachedItemKey(string path, string verb, CachedVary ca
931931 return sb . ToString ( ) ;
932932 }
933933 string coding = response . HeaderEncoding . ToString ( ) ;
934- if ( contentEncodings . Any ( t => t == coding ) ) {
934+ if ( contentEncodings . Any ( t => t . Equals ( coding , StringComparison . OrdinalIgnoreCase ) ) ) {
935935 sb . Append ( coding ) ;
936936 }
937937 // The key must end in "E", or the VaryByContentEncoding feature will break. Unfortunately,
@@ -1070,7 +1070,7 @@ private bool CheckIfModifiedSince(HttpCachePolicySettings settings) {
10701070 }
10711071
10721072 private bool checkMaxAge ( string directive , HttpCachePolicySettings settings ) {
1073- if ( directive == CacheDirectives . NoCache || directive == CacheDirectives . NoStore ) {
1073+ if ( directive . Equals ( CacheDirectives . NoCache , StringComparison . OrdinalIgnoreCase ) || directive . Equals ( CacheDirectives . NoStore , StringComparison . OrdinalIgnoreCase ) ) {
10741074 return true ;
10751075 }
10761076 if ( directive . StartsWith ( CacheDirectives . MaxAge ) ) {
0 commit comments