FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CefSharp/CefSharp.Core.Runtime/Request.cpp at cefsharp/97 · cefsharp/CefSharp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
cefsharp
/
CefSharp
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
2.9k
Star
10.2k
Code
Issues
61
Pull requests
13
Discussions
Actions
Wiki
Security and quality
9
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
CefSharp
/
CefSharp.Core.Runtime
/
Request.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
213 lines (161 loc) · 5.37 KB
Breadcrumbs
CefSharp
/
CefSharp.Core.Runtime
/
Request.cpp
Copy path
File metadata and controls
213 lines (161 loc) · 5.37 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
//
Copyright © 2010 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.
#
include
"
Stdafx.h
"
#
include
"
Request.h
"
#
include
"
PostData.h
"
using
namespace
System
::Text
;
namespace
CefSharp
{
namespace
Core
{
UrlRequestFlags
Request::Flags::get
()
{
ThrowIfDisposed
();
return
(UrlRequestFlags)_request->
GetFlags
();
}
void
Request::Flags::set
(UrlRequestFlags flags)
{
ThrowIfDisposed
();
ThrowIfReadOnly
();
_request->
SetFlags
((
int
)flags);
}
String^ Request::Url::get()
{
ThrowIfDisposed
();
return
StringUtils::ToClr
(_request->
GetURL
());
}
void
Request::Url::set
(String^ url)
{
if
(url ==
nullptr
)
{
throw
gcnew
System::ArgumentException
(
"
cannot be null
"
,
"
url
"
);
}
ThrowIfDisposed
();
ThrowIfReadOnly
();
CefString str =
StringUtils::ToNative
(url);
_request->
SetURL
(str);
}
String^ Request::Method::get()
{
ThrowIfDisposed
();
return
StringUtils::ToClr
(_request->
GetMethod
());
}
void
Request::Method::set
(String^ method)
{
if
(method ==
nullptr
)
{
throw
gcnew
System::ArgumentException
(
"
cannot be null
"
,
"
method
"
);
}
ThrowIfDisposed
();
ThrowIfReadOnly
();
_request->
SetMethod
(
StringUtils::ToNative
(method));
}
UInt64
Request::Identifier::get
()
{
ThrowIfDisposed
();
return
_request->
GetIdentifier
();
}
void
Request::SetReferrer
(String^ referrerUrl, CefSharp::ReferrerPolicy policy)
{
ThrowIfDisposed
();
ThrowIfReadOnly
();
_request->
SetReferrer
(
StringUtils::ToNative
(referrerUrl), (
cef_referrer_policy_t
)policy);
}
String^ Request::ReferrerUrl::get()
{
ThrowIfDisposed
();
return
StringUtils::ToClr
(_request->
GetReferrerURL
());
}
CefSharp::ResourceType
Request::ResourceType::get
()
{
ThrowIfDisposed
();
return
(CefSharp::ResourceType)_request->
GetResourceType
();
}
CefSharp::ReferrerPolicy
Request::ReferrerPolicy::get
()
{
ThrowIfDisposed
();
return
(CefSharp::ReferrerPolicy)_request->
GetReferrerPolicy
();
}
NameValueCollection^ Request::Headers::get()
{
ThrowIfDisposed
();
CefRequest::HeaderMap hm;
_request->
GetHeaderMap
(hm);
auto
headers = gcnew
HeaderNameValueCollection
();
for
(CefRequest::HeaderMap::iterator it = hm.
begin
(); it != hm.
end
(); ++it)
{
String^ name =
StringUtils::ToClr
(it->
first
);
String^ value =
StringUtils::ToClr
(it->
second
);
headers->
Add
(name, value);
}
if
(_request->
IsReadOnly
())
{
headers->
SetReadOnly
();
}
return
headers;
}
void
Request::Headers::set
(NameValueCollection^ headers)
{
ThrowIfDisposed
();
ThrowIfReadOnly
();
CefRequest::HeaderMap hm;
for
each
(String^ key in headers)
{
CefString name =
StringUtils::ToNative
(key);
for
each
(String^ element in headers->
GetValues
(key))
{
CefString value =
StringUtils::ToNative
(element);
hm.
insert
(
std::make_pair
(name, value));
}
}
_request->
SetHeaderMap
(hm);
}
TransitionType
Request::TransitionType::get
()
{
ThrowIfDisposed
();
return
(CefSharp::TransitionType) _request->
GetTransitionType
();
}
IPostData^ Request::PostData::get()
{
ThrowIfDisposed
();
if
(_postData ==
nullptr
)
{
auto
postData = _request->
GetPostData
();
if
(postData.
get
())
{
_postData = gcnew
CefSharp::Core::PostData
(postData);
}
}
return
_postData;
}
void
Request::PostData::set
(IPostData^ postData)
{
ThrowIfDisposed
();
ThrowIfReadOnly
();
_request->
SetPostData
((CefSharp::Core::PostData^)postData->
UnWrap
());
}
bool
Request::IsReadOnly::get
()
{
ThrowIfDisposed
();
return
_request->
IsReadOnly
();
}
void
Request::InitializePostData
()
{
ThrowIfDisposed
();
ThrowIfReadOnly
();
_request->
SetPostData
(
CefPostData::Create
());
}
String^ Request::GetHeaderByName(String^ name)
{
ThrowIfDisposed
();
return
StringUtils::ToClr
(_request->
GetHeaderByName
(
StringUtils::ToNative
(name)));
}
void
Request::SetHeaderByName
(String^ name, String^ value,
bool
overwrite)
{
ThrowIfDisposed
();
ThrowIfReadOnly
();
_request->
SetHeaderByName
(
StringUtils::ToNative
(name),
StringUtils::ToNative
(value), overwrite);
}
}
}
Back
|
FazBrowse Home
|
New Git URL