/// <summary> /// Constructs a <see cref="DynamicRequestHeaderFilter"/>. /// </summary> /// <param name="dynamicHeaders">An enumerable set of <see cref="KeyValuePair{TKey, TValue}"/>s where each key is the name of a header and each value is a string returning function for the header value.</param> /// <param name="applyHeadersCondition">A <see cref="IWebHttpRequestCondition"/> implementation used to determine if the dynamic headers should be applied. If null, headers are applied to all requests.</param> /// <param name="innerFilter">The next filter in the pipeline to pass requests to after the dynamic headers are added.</param> public DynamicRequestHeaderFilter(IEnumerable <KeyValuePair <string, Func <string> > > dynamicHeaders, IWebHttpRequestCondition applyHeadersCondition, Windows.Web.Http.Filters.IHttpFilter innerFilter) { if (dynamicHeaders == null) { throw new ArgumentNullException(nameof(dynamicHeaders)); } if (innerFilter == null) { throw new ArgumentNullException(nameof(innerFilter)); } _InnerFilter = innerFilter; _ApplyHeadersCondition = applyHeadersCondition; _DynamicHeaders = dynamicHeaders; }
/// <summary> /// Full constructor. /// </summary> /// <param name="innerFilter">The next handler in the pipeline to process requests.</param> /// <param name="maxRedirects">The maximum number of automatic redirections for the handler to follow per request.</param> /// <param name="redirectCache">A <see cref="RedirectCache"/> instance to use for caching known redirects.</param> /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="innerFilter"/> is null.</exception> /// <exception cref="System.ArgumentOutOfRangeException">Thrown if <paramref name="maxRedirects"/> is less than zero.</exception> public InsecureRedirectionFilter(IHttpFilter innerFilter, int maxRedirects, IRedirectCache redirectCache) { if (innerFilter == null) { throw new ArgumentNullException(nameof(innerFilter)); } if (maxRedirects < 0) { throw new ArgumentOutOfRangeException(nameof(maxRedirects)); } _InnerFilter = innerFilter; MaxRedirects = maxRedirects; _RedirectCache = redirectCache ?? new RedirectCache(); }
/// <summary> /// Constructs a <see cref="DynamicRequestHeaderFilter"/>. /// </summary> /// <param name="dynamicHeaders">An enumerable set of <see cref="KeyValuePair{TKey, TValue}"/>s where each key is the name of a header and each value is a string returning function for the header value.</param> /// <param name="innerFilter">The next filter in the pipeline to pass requests to after the dynamic headers are added.</param> public DynamicRequestHeaderFilter(IEnumerable <KeyValuePair <string, Func <string> > > dynamicHeaders, Windows.Web.Http.Filters.IHttpFilter innerFilter) : this(dynamicHeaders, null, innerFilter) { }