// Copyright © 2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; using System.Collections.Specialized; namespace CefSharp { /// /// Class used to represent a web request. The methods of this class may be called on any thread. /// public interface IRequest : IDisposable { ///// ///// Get/Set the Url to the first party for cookies used in combination with CefURLRequest. ///// ///// Note: If we every implment CefURLRequest then this will need to be added ////string FirstPartyForCookies { get; set; } /// /// Get/Set request flags, can be used to control caching policy /// UrlRequestFlags Flags { get; set; } /// /// Request Url /// string Url { get; set; } /// /// Returns the globally unique identifier for this request or 0 if not specified. /// Can be used by implementations in the browser process to track a /// single request across multiple callbacks. /// ulong Identifier { get; } /// /// Request Method GET/POST etc /// string Method { get; set; } /// /// Set the referrer URL and policy. If non-empty the referrer URL must be /// fully qualified with an HTTP or HTTPS scheme component. Any username, /// password or ref component will be removed. /// /// the referrer url /// referrer policy void SetReferrer(string referrerUrl, ReferrerPolicy policy); /// /// Get the referrer URL. /// string ReferrerUrl { get; } /// /// Get the resource type for this request. /// ResourceType ResourceType { get; } /// /// Get the referrer policy. /// ReferrerPolicy ReferrerPolicy { get; } /// /// Header Collection - If dealing with headers that only contain a single value then /// it's easier to use or . /// You cannot modify the referrer using headers, use . /// NOTE: This collection is a copy of the underlying type, to make changes, take a reference to the collection, /// make your changes, then reassign the collection. /// /// /// This example shows how to modify headers, make sure you reassign the collection /// once it's been modified. /// /// var headers = request.Headers; /// var userAgent = headers["User-Agent"]; /// headers["User-Agent"] = userAgent + " CefSharp"; /// request.Headers = headers; /// /// NameValueCollection Headers { get; set; } /// /// Post data /// IPostData PostData { get; set; } /// /// Get the transition type for this request. /// Applies to requests that represent a main frame or sub-frame navigation. /// TransitionType TransitionType { get; } /// /// Gets a value indicating whether the request has been disposed of. /// bool IsDisposed { get; } /// /// Returns true if this object is read-only. /// bool IsReadOnly { get; } /// /// Initialize a new instance of . /// Make sure to check if the is null /// before calling otherwise the existing data will be overridden. /// void InitializePostData(); /// /// Returns the first header value for name or an empty string if not found. /// Will not return the Referer value if any. Use instead if name might have multiple values. /// /// header name /// Returns the first header value for name or an empty string if not found. string GetHeaderByName(string name); /// /// Set the header name to value. The Referer value cannot be set using this method. /// Use instead. /// /// header name /// new header value /// If overwrite is true any existing values will be replaced with the new value. If overwrite is false any existing values will not be overwritten void SetHeaderByName(string name, string value, bool overwrite); } }