admin
2020-06-10 a610f2ab6e543d2cb78c1ef212ac6a74ddc067d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// 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
{
    /// <summary>
    /// Class used to represent a web request. The methods of this class may be called on any thread. 
    /// </summary>
    public interface IRequest : IDisposable
    {
        ///// <summary>
        ///// Get/Set the Url to the first party for cookies used in combination with CefURLRequest.
        ///// </summary>
        ///// Note: If we every implment CefURLRequest then this will need to be added
        ////string FirstPartyForCookies { get; set; }
 
        /// <summary>
        /// Get/Set request flags, can be used to control caching policy
        /// </summary>
        UrlRequestFlags Flags { get; set; }
 
        /// <summary>
        /// Request Url
        /// </summary>
        string Url { get; set; }
 
        /// <summary>
        /// Returns the globally unique identifier for this request or 0 if not specified.
        /// Can be used by <see cref="IRequestHandler"/> implementations in the browser process to track a
        /// single request across multiple callbacks.
        /// </summary>
        ulong Identifier { get; }
 
        /// <summary>
        /// Request Method GET/POST etc
        /// </summary>
        string Method { get; set; }
 
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="referrerUrl">the referrer url</param>
        /// <param name="policy">referrer policy</param>
        void SetReferrer(string referrerUrl, ReferrerPolicy policy);
 
        /// <summary>
        /// Get the referrer URL.
        /// </summary>
        string ReferrerUrl { get; }
 
        /// <summary>
        /// Get the resource type for this request.
        /// </summary>
        ResourceType ResourceType { get; }
 
        /// <summary>
        /// Get the referrer policy.
        /// </summary>
        ReferrerPolicy ReferrerPolicy { get; }
 
        /// <summary>
        /// Header Collection - If dealing with headers that only contain a single value then
        /// it's easier to use <see cref="SetHeaderByName(string, string, bool)"/> or <see cref="GetHeaderByName(string)"/>.
        /// You cannot modify the referrer using headers, use <see cref="SetReferrer(string, ReferrerPolicy)"/>.
        /// 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.
        /// </summary>
        /// <example> 
        /// This example shows how to modify headers, make sure you reassign the collection
        /// once it's been modified.
        /// <code>
        /// var headers = request.Headers;
        /// var userAgent = headers["User-Agent"];
        /// headers["User-Agent"] = userAgent + " CefSharp";
        /// request.Headers = headers;
        /// </code>
        /// </example>
        NameValueCollection Headers { get; set; }
 
        /// <summary>
        /// Post data
        /// </summary>
        IPostData PostData { get; set; }
 
        /// <summary>
        /// Get the transition type for this request.
        /// Applies to requests that represent a main frame or sub-frame navigation.
        /// </summary>
        TransitionType TransitionType { get; }
 
        /// <summary>
        /// Gets a value indicating whether the request has been disposed of.
        /// </summary>
        bool IsDisposed { get; }
 
        /// <summary>
        /// Returns true if this object is read-only.
        /// </summary>
        bool IsReadOnly { get; }
 
        /// <summary>
        /// Initialize a new instance of <see cref="IPostData"/>.
        /// Make sure to check if the <see cref="PostData"/> is null
        /// before calling otherwise the existing data will be overridden. 
        /// </summary>
        void InitializePostData();
 
        /// <summary>
        /// Returns the first header value for name or an empty string if not found.
        /// Will not return the Referer value if any. Use <see cref="Headers"/> instead if name might have multiple values.
        /// </summary>
        /// <param name="name">header name</param>
        /// <returns>Returns the first header value for name or an empty string if not found.</returns>
        string GetHeaderByName(string name);
 
        /// <summary>
        /// Set the header name to value. The Referer value cannot be set using this method.
        /// Use <see cref="SetReferrer(string, ReferrerPolicy)"/> instead.
        /// </summary>
        /// <param name="name">header name</param>
        /// <param name="value">new header value</param>
        /// <param name="overwrite">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</param>
        void SetHeaderByName(string name, string value, bool overwrite);
    }
}