Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / xsp / System / Web / Extensions / Util / HeaderUtility.cs / 1 / HeaderUtility.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Util {
using System;
internal static class HeaderUtility {
public static bool IsEncodingInAcceptList(string acceptEncodingHeader, string expectedEncoding) {
if (String.IsNullOrEmpty(acceptEncodingHeader)) {
return false;
}
foreach (string encoding in acceptEncodingHeader.Split(',')) {
string e = encoding.Trim();
// This code will typically handle all existing browsers, which
// use "encoding1, encoding2" for this header.
// IE, Firefox and Safari are sending "gzip, deflate"
// Opera is sending "deflate, gzip, x-gzip, identity, *;q=0"
// There is a currently hypothetical case where a browser would use the quantified syntax
// on specific encodings ("encoding1;q=0.8, encoding2 ;q=0.2") which we don't handle here.
// For those situations, the browser would get the uncompressed version.
// See RFC 2068 for details.
if (String.Equals(e, expectedEncoding, StringComparison.Ordinal)) {
return true;
}
}
// no match found
return false;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Util {
using System;
internal static class HeaderUtility {
public static bool IsEncodingInAcceptList(string acceptEncodingHeader, string expectedEncoding) {
if (String.IsNullOrEmpty(acceptEncodingHeader)) {
return false;
}
foreach (string encoding in acceptEncodingHeader.Split(',')) {
string e = encoding.Trim();
// This code will typically handle all existing browsers, which
// use "encoding1, encoding2" for this header.
// IE, Firefox and Safari are sending "gzip, deflate"
// Opera is sending "deflate, gzip, x-gzip, identity, *;q=0"
// There is a currently hypothetical case where a browser would use the quantified syntax
// on specific encodings ("encoding1;q=0.8, encoding2 ;q=0.2") which we don't handle here.
// For those situations, the browser would get the uncompressed version.
// See RFC 2068 for details.
if (String.Equals(e, expectedEncoding, StringComparison.Ordinal)) {
return true;
}
}
// no match found
return false;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SqlCommandBuilder.cs
- ToolBarButton.cs
- ToolStripPanelSelectionBehavior.cs
- MenuAdapter.cs
- CompositeScriptReference.cs
- WindowCollection.cs
- CharacterBuffer.cs
- TypeUtils.cs
- DatagridviewDisplayedBandsData.cs
- EntityDataSourceConfigureObjectContext.cs
- SqlDependency.cs
- FontCacheUtil.cs
- BuilderPropertyEntry.cs
- GridItemPatternIdentifiers.cs
- ReadOnlyDataSourceView.cs
- SvcMapFileSerializer.cs
- UnsignedPublishLicense.cs
- CodeRegionDirective.cs
- InfoCardAsymmetricCrypto.cs
- XmlHierarchicalDataSourceView.cs
- SpanIndex.cs
- FileSystemEventArgs.cs
- COM2ExtendedUITypeEditor.cs
- SQLSingleStorage.cs
- EdmFunctionAttribute.cs
- SQLGuidStorage.cs
- DataChangedEventManager.cs
- WindowInteractionStateTracker.cs
- Selector.cs
- WebSysDisplayNameAttribute.cs
- RegexGroup.cs
- CharacterMetrics.cs
- StaticContext.cs
- RtfControls.cs
- _SafeNetHandles.cs
- BitmapSource.cs
- BlobPersonalizationState.cs
- ResourceExpressionEditorSheet.cs
- DbException.cs
- SqlDataSourceEnumerator.cs
- StrokeNode.cs
- ChtmlCommandAdapter.cs
- InheritedPropertyChangedEventArgs.cs
- DynamicRendererThreadManager.cs
- FlowLayout.cs
- XmlParserContext.cs
- SiteMapHierarchicalDataSourceView.cs
- EntityConnectionStringBuilder.cs
- SqlPersonalizationProvider.cs
- PriorityRange.cs
- SourceChangedEventArgs.cs
- XmlElementCollection.cs
- BaseTreeIterator.cs
- HtmlInputRadioButton.cs
- ListBoxItemWrapperAutomationPeer.cs
- RequestNavigateEventArgs.cs
- webeventbuffer.cs
- DependentList.cs
- FixedDocumentSequencePaginator.cs
- DirectoryInfo.cs
- ProxyGenerator.cs
- ToolStripSeparatorRenderEventArgs.cs
- webproxy.cs
- FrameworkPropertyMetadata.cs
- _ChunkParse.cs
- WebPartEditorOkVerb.cs
- ConfigurationLocation.cs
- OleDbWrapper.cs
- Stopwatch.cs
- XmlSchemaImporter.cs
- DoWorkEventArgs.cs
- StyleReferenceConverter.cs
- PerformanceCounterPermissionEntryCollection.cs
- ImpersonationContext.cs
- CookieHandler.cs
- ConsoleTraceListener.cs
- DbReferenceCollection.cs
- FilePrompt.cs
- DataKey.cs
- MultiAsyncResult.cs
- ConfigurationValidatorAttribute.cs
- MetafileHeaderWmf.cs
- PageParser.cs
- QueryResultOp.cs
- CommonObjectSecurity.cs
- cookieexception.cs
- SourceLineInfo.cs
- ChangeProcessor.cs
- ClientRequest.cs
- EntityEntry.cs
- SecurityContextKeyIdentifierClause.cs
- OLEDB_Enum.cs
- WebDisplayNameAttribute.cs
- _FtpControlStream.cs
- ErrorStyle.cs
- TextEditorTyping.cs
- wgx_commands.cs
- DynamicMetaObjectBinder.cs
- CqlErrorHelper.cs
- DoubleUtil.cs