358 references to WinHttp
System.Net.Http.WinHttpHandler (358)
_generated\0\LibraryImports.g.cs (66)
155
public static partial global::Interop.
WinHttp
.SafeWinHttpHandle WinHttpOpen(nint userAgent, uint accessType, string proxyName, string proxyBypass, int flags)
159
global::Interop.
WinHttp
.SafeWinHttpHandle __retVal = default;
162
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
230
public static partial global::Interop.
WinHttp
.SafeWinHttpHandle WinHttpConnect(global::Interop.
WinHttp
.SafeWinHttpHandle sessionHandle, string serverName, ushort serverPort, uint reserved)
235
global::Interop.
WinHttp
.SafeWinHttpHandle __retVal = default;
238
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
239
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __sessionHandle_native__marshaller = new();
286
public static partial global::Interop.
WinHttp
.SafeWinHttpHandle WinHttpOpenRequest(global::Interop.
WinHttp
.SafeWinHttpHandle connectHandle, string verb, string objectName, string version, string referrer, string acceptTypes, uint flags)
291
global::Interop.
WinHttp
.SafeWinHttpHandle __retVal = default;
294
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
295
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __connectHandle_native__marshaller = new();
346
public static partial bool WinHttpAddRequestHeaders(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, global::System.Text.StringBuilder headers, uint headersLength, uint modifiers)
354
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
358
__headers_native = (void*)global::Interop.
WinHttp
.SimpleStringBufferMarshaller.ConvertToUnmanaged(headers);
374
global::Interop.
WinHttp
.SimpleStringBufferMarshaller.Free(__headers_native);
392
public static partial bool WinHttpAddRequestHeaders(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, string headers, uint headersLength, uint modifiers)
399
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
437
public static partial bool WinHttpSendRequest(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, nint headers, uint headersLength, nint optional, uint optionalLength, uint totalLength, nint context)
444
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
480
public static partial bool WinHttpReceiveResponse(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, nint reserved)
487
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
523
public static partial bool WinHttpQueryDataAvailable(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, nint parameterIgnoredAndShouldBeNullForAsync)
530
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
566
public static partial bool WinHttpReadData(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, nint buffer, uint bufferSize, nint parameterIgnoredAndShouldBeNullForAsync)
573
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
609
public static partial bool WinHttpQueryHeaders(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, uint infoLevel, string name, nint buffer, ref uint bufferLength, ref uint index)
616
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
656
public static partial bool WinHttpQueryHeaders(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, uint infoLevel, string name, ref uint number, ref uint bufferLength, nint index)
663
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
703
public static partial bool WinHttpQueryOption(global::Interop.
WinHttp
.SafeWinHttpHandle handle, uint option, ref nint buffer, ref uint bufferSize)
710
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
749
public static partial bool WinHttpQueryOption(global::Interop.
WinHttp
.SafeWinHttpHandle handle, uint option, nint buffer, ref uint bufferSize)
756
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
794
public static partial bool WinHttpQueryOption(global::Interop.
WinHttp
.SafeWinHttpHandle handle, uint option, ref uint buffer, ref uint bufferSize)
801
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
840
public static partial bool WinHttpWriteData(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, nint buffer, uint bufferSize, nint parameterIgnoredAndShouldBeNullForAsync)
847
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
883
public static partial bool WinHttpSetOption(global::Interop.
WinHttp
.SafeWinHttpHandle handle, uint option, ref uint optionData, uint optionLength)
890
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
928
public static partial bool WinHttpSetOption(global::Interop.
WinHttp
.SafeWinHttpHandle handle, uint option, nint optionData, uint optionLength)
935
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
971
public static partial bool WinHttpSetCredentials(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, uint authTargets, uint authScheme, string userName, string password, nint reserved)
978
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
1017
public static partial bool WinHttpQueryAuthSchemes(global::Interop.
WinHttp
.SafeWinHttpHandle requestHandle, out uint supportedSchemes, out uint firstScheme, out uint authTarget)
1027
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __requestHandle_native__marshaller = new();
1067
public static partial bool WinHttpSetTimeouts(global::Interop.
WinHttp
.SafeWinHttpHandle handle, int resolveTimeout, int connectTimeout, int sendTimeout, int receiveTimeout)
1074
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
1110
public static partial bool WinHttpGetIEProxyConfigForCurrentUser(out global::Interop.
WinHttp
.WINHTTP_CURRENT_USER_IE_PROXY_CONFIG proxyConfig)
1117
fixed (global::Interop.
WinHttp
.WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* __proxyConfig_native = &proxyConfig)
1130
static extern unsafe int __PInvoke(global::Interop.
WinHttp
.WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* __proxyConfig_native);
1140
public static partial bool WinHttpGetProxyForUrl(global::Interop.
WinHttp
.SafeWinHttpHandle sessionHandle, string url, ref global::Interop.
WinHttp
.WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions, out global::Interop.
WinHttp
.WINHTTP_PROXY_INFO proxyInfo)
1145
global::Interop.
WinHttp
.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.Native __autoProxyOptions_native = default;
1149
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __sessionHandle_native__marshaller = new();
1153
__autoProxyOptions_native = global::Interop.
WinHttp
.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.ConvertToUnmanaged(autoProxyOptions);
1156
fixed (global::Interop.
WinHttp
.WINHTTP_PROXY_INFO* __proxyInfo_native = &proxyInfo)
1168
autoProxyOptions = global::Interop.
WinHttp
.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.ConvertToManaged(__autoProxyOptions_native);
1173
global::Interop.
WinHttp
.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.Free(__autoProxyOptions_native);
1181
static extern unsafe int __PInvoke(nint __sessionHandle_native, ushort* __url_native, global::Interop.
WinHttp
.WINHTTP_AUTOPROXY_OPTIONS.Marshaller.Native* __autoProxyOptions_native, global::Interop.
WinHttp
.WINHTTP_PROXY_INFO* __proxyInfo_native);
1191
public static partial nint WinHttpSetStatusCallback(global::Interop.
WinHttp
.SafeWinHttpHandle handle, global::Interop.
WinHttp
.WINHTTP_STATUS_CALLBACK callback, uint notificationFlags, nint reserved)
1198
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.
WinHttp
.SafeWinHttpHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
src\runtime\src\libraries\Common\src\Interop\Windows\WinHttp\Interop.SafeWinHttpHandle.cs (1)
56
return Interop.
WinHttp
.WinHttpCloseHandle(handle);
System\Net\Http\WinHttpAuthHelper.cs (27)
6
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
40
Interop.
WinHttp
.WINHTTP_AUTH_SCHEME_NEGOTIATE,
41
Interop.
WinHttp
.WINHTTP_AUTH_SCHEME_NTLM,
42
Interop.
WinHttp
.WINHTTP_AUTH_SCHEME_DIGEST,
43
Interop.
WinHttp
.WINHTTP_AUTH_SCHEME_BASIC
67
Interop.
WinHttp
.WINHTTP_QUERY_STATUS_CODE);
86
if (!Interop.
WinHttp
.WinHttpQueryAuthSchemes(
99
Debug.Assert(authTarget == Interop.
WinHttp
.WINHTTP_AUTH_TARGET_SERVER);
139
if (!Interop.
WinHttp
.WinHttpQueryAuthSchemes(
152
Debug.Assert(authTarget == Interop.
WinHttp
.WINHTTP_AUTH_TARGET_PROXY);
210
Interop.
WinHttp
.WINHTTP_AUTH_TARGET_PROXY);
228
Interop.
WinHttp
.WINHTTP_AUTH_TARGET_SERVER);
293
Debug.Assert(authTarget == Interop.
WinHttp
.WINHTTP_AUTH_TARGET_PROXY ||
294
authTarget == Interop.
WinHttp
.WINHTTP_AUTH_TARGET_SERVER);
297
(authTarget == Interop.
WinHttp
.WINHTTP_AUTH_TARGET_PROXY ?
298
Interop.
WinHttp
.WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM :
299
Interop.
WinHttp
.WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW) :
300
Interop.
WinHttp
.WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH;
302
if (!Interop.
WinHttp
.WinHttpSetOption(
304
Interop.
WinHttp
.WINHTTP_OPTION_AUTOLOGON_POLICY,
307
WinHttpException.ThrowExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpSetOption));
323
Debug.Assert(authTarget == Interop.
WinHttp
.WINHTTP_AUTH_TARGET_PROXY ||
324
authTarget == Interop.
WinHttp
.WINHTTP_AUTH_TARGET_SERVER);
339
if (authScheme == Interop.
WinHttp
.WINHTTP_AUTH_SCHEME_NEGOTIATE ||
340
authScheme == Interop.
WinHttp
.WINHTTP_AUTH_SCHEME_NTLM)
370
if (!Interop.
WinHttp
.WinHttpSetCredentials(
378
WinHttpException.ThrowExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpSetCredentials));
System\Net\Http\WinHttpChannelBinding.cs (6)
8
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
21
if (!Interop.
WinHttp
.WinHttpQueryOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_SERVER_CBT, IntPtr.Zero, ref dataSize))
23
if (Marshal.GetLastWin32Error() == Interop.
WinHttp
.ERROR_INSUFFICIENT_BUFFER)
27
if (Interop.
WinHttp
.WinHttpQueryOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_SERVER_CBT, data, ref dataSize))
System\Net\Http\WinHttpCookieContainerAdapter.cs (9)
8
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
34
requestHandle, Interop.
WinHttp
.WINHTTP_QUERY_SET_COOKIE, ref buffer, ref index, out cookieHeader))
59
if (!Interop.
WinHttp
.WinHttpAddRequestHeaders(
63
Interop.
WinHttp
.WINHTTP_ADDREQ_FLAG_REPLACE))
66
if (lastError != Interop.
WinHttp
.ERROR_WINHTTP_HEADER_NOT_FOUND)
68
throw WinHttpException.CreateExceptionUsingError(lastError, nameof(Interop.
WinHttp
.WinHttpAddRequestHeaders));
77
if (!Interop.
WinHttp
.WinHttpAddRequestHeaders(
81
Interop.
WinHttp
.WINHTTP_ADDREQ_FLAG_ADD))
83
throw WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpAddRequestHeaders));
System\Net\Http\WinHttpException.cs (2)
42
Interop.
WinHttp
.ERROR_WINHTTP_CONNECTION_ERROR => unchecked((int)Interop.
WinHttp
.WININET_E_CONNECTION_RESET),
System\Net\Http\WinHttpHandler.cs (106)
19
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
762
if (!Interop.
WinHttp
.WinHttpAddRequestHeaders(
766
Interop.
WinHttp
.WINHTTP_ADDREQ_FLAG_ADD))
768
throw WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpAddRequestHeaders));
810
accessType = Interop.
WinHttp
.WINHTTP_ACCESS_TYPE_NO_PROXY;
815
accessType = Interop.
WinHttp
.WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
820
accessType = Interop.
WinHttp
.WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY;
825
sessionHandle = Interop.
WinHttp
.WinHttpOpen(
828
Interop.
WinHttp
.WINHTTP_NO_PROXY_NAME,
829
Interop.
WinHttp
.WINHTTP_NO_PROXY_BYPASS,
830
(int)Interop.
WinHttp
.WINHTTP_FLAG_ASYNC);
831
ThrowOnInvalidHandle(sessionHandle, nameof(Interop.
WinHttp
.WinHttpOpen));
835
if (!Interop.
WinHttp
.WinHttpSetOption(
837
Interop.
WinHttp
.WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS,
844
if (lastError != Interop.
WinHttp
.ERROR_WINHTTP_INVALID_OPTION)
846
throw WinHttpException.CreateExceptionUsingError(lastError, nameof(Interop.
WinHttp
.WinHttpSetOption));
888
connectHandle = Interop.
WinHttp
.WinHttpConnect(
893
ThrowOnInvalidHandle(connectHandle, nameof(Interop.
WinHttp
.WinHttpConnect));
1004
SetWinHttpOption(state.RequestHandle, Interop.
WinHttp
.WINHTTP_OPTION_RECEIVE_TIMEOUT, ref optionData);
1048
requestHandle = Interop.
WinHttp
.WinHttpOpenRequest(
1053
Interop.
WinHttp
.WINHTTP_NO_REFERER,
1054
Interop.
WinHttp
.WINHTTP_DEFAULT_ACCEPT_TYPES,
1063
if (lastError != Interop.
WinHttp
.ERROR_INVALID_PARAMETER || chunkedModeForSend != WinHttpChunkMode.Automatic)
1065
ThrowOnInvalidHandle(requestHandle, nameof(Interop.
WinHttp
.WinHttpOpenRequest));
1073
requestHandle = Interop.
WinHttp
.WinHttpOpenRequest(
1078
Interop.
WinHttp
.WINHTTP_NO_REFERER,
1079
Interop.
WinHttp
.WINHTTP_DEFAULT_ACCEPT_TYPES,
1082
ThrowOnInvalidHandle(requestHandle, nameof(Interop.
WinHttp
.WinHttpOpenRequest));
1090
uint flags = Interop.
WinHttp
.WINHTTP_FLAG_ESCAPE_DISABLE;
1093
flags |= Interop.
WinHttp
.WINHTTP_FLAG_SECURE;
1097
flags |= Interop.
WinHttp
.WINHTTP_FLAG_AUTOMATIC_CHUNKING;
1118
var tcpKeepalive = new Interop.
WinHttp
.tcp_keepalive
1131
Interop.
WinHttp
.WINHTTP_OPTION_TCP_KEEPALIVE,
1133
(uint)sizeof(Interop.
WinHttp
.tcp_keepalive));
1148
if (!Interop.
WinHttp
.WinHttpSetOption(sessionHandle, Interop.
WinHttp
.WINHTTP_OPTION_REQUIRE_STREAM_END, ref optionData))
1161
SetWinHttpOption(sessionHandle, Interop.
WinHttp
.WINHTTP_OPTION_MAX_CONNS_PER_SERVER, ref optionData);
1162
SetWinHttpOption(sessionHandle, Interop.
WinHttp
.WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER, ref optionData);
1178
optionData |= Interop.
WinHttp
.WINHTTP_FLAG_SECURE_PROTOCOL_SSL2;
1183
optionData |= Interop.
WinHttp
.WINHTTP_FLAG_SECURE_PROTOCOL_SSL3;
1190
optionData |= Interop.
WinHttp
.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1;
1195
optionData |= Interop.
WinHttp
.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1;
1201
optionData |= Interop.
WinHttp
.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
1207
optionData |= Interop.
WinHttp
.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3;
1214
unchecked((int)Interop.
WinHttp
.ERROR_INVALID_PARAMETER),
1218
SetWinHttpOption(sessionHandle, Interop.
WinHttp
.WINHTTP_OPTION_SECURE_PROTOCOLS, ref optionData);
1226
using (SafeWinHttpHandle sessionHandle = Interop.
WinHttp
.WinHttpOpen(
1228
Interop.
WinHttp
.WINHTTP_ACCESS_TYPE_NO_PROXY,
1229
Interop.
WinHttp
.WINHTTP_NO_PROXY_NAME,
1230
Interop.
WinHttp
.WINHTTP_NO_PROXY_BYPASS,
1231
(int)Interop.
WinHttp
.WINHTTP_FLAG_ASYNC))
1233
uint optionData = Interop.
WinHttp
.WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3;
1235
handler.SetWinHttpOption(sessionHandle, Interop.
WinHttp
.WINHTTP_OPTION_SECURE_PROTOCOLS, ref optionData);
1247
if (!Interop.
WinHttp
.WinHttpSetTimeouts(
1254
WinHttpException.ThrowExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpSetTimeouts));
1285
Interop.
WinHttp
.WINHTTP_PROXY_INFO proxyInfo = default;
1298
proxyInfo.AccessType = Interop.
WinHttp
.WINHTTP_ACCESS_TYPE_NO_PROXY;
1302
proxyInfo.AccessType = Interop.
WinHttp
.WINHTTP_ACCESS_TYPE_NAMED_PROXY;
1316
Interop.
WinHttp
.WINHTTP_OPTION_PROXY,
1342
optionData |= Interop.
WinHttp
.WINHTTP_DECOMPRESSION_FLAG_GZIP;
1347
optionData |= Interop.
WinHttp
.WINHTTP_DECOMPRESSION_FLAG_DEFLATE;
1350
SetWinHttpOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_DECOMPRESSION, ref optionData);
1363
Interop.
WinHttp
.WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS,
1368
Interop.
WinHttp
.WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP :
1369
Interop.
WinHttp
.WINHTTP_OPTION_REDIRECT_POLICY_NEVER;
1370
SetWinHttpOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_REDIRECT_POLICY, ref optionData);
1378
uint optionData = Interop.
WinHttp
.WINHTTP_DISABLE_COOKIES;
1379
SetWinHttpOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_DISABLE_FEATURE, ref optionData);
1392
Interop.
WinHttp
.SECURITY_FLAG_IGNORE_UNKNOWN_CA |
1393
Interop.
WinHttp
.SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE |
1394
Interop.
WinHttp
.SECURITY_FLAG_IGNORE_CERT_CN_INVALID |
1395
Interop.
WinHttp
.SECURITY_FLAG_IGNORE_CERT_DATE_INVALID;
1396
SetWinHttpOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_SECURITY_FLAGS, ref optionData);
1401
optionData = Interop.
WinHttp
.WINHTTP_ENABLE_SSL_REVOCATION;
1402
SetWinHttpOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_ENABLE_FEATURE, ref optionData);
1427
Interop.
WinHttp
.WINHTTP_OPTION_CLIENT_CERT_CONTEXT,
1448
uint optionData = Interop.
WinHttp
.WINHTTP_HTTP2_PLUS_CLIENT_CERT_FLAG;
1449
if (Interop.
WinHttp
.WinHttpSetOption(
1451
Interop.
WinHttp
.WINHTTP_OPTION_ENABLE_HTTP2_PLUS_CLIENT_CERT,
1467
if (Interop.
WinHttp
.WinHttpSetOption(sessionHandle, Interop.
WinHttp
.WINHTTP_OPTION_DISABLE_STREAM_QUEUE, ref optionData))
1482
Interop.
WinHttp
.WINHTTP_OPTION_CLIENT_CERT_CONTEXT,
1500
Interop.
WinHttp
.WINHTTP_AUTH_TARGET_SERVER,
1507
SetWinHttpOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE, ref optionData);
1509
SetWinHttpOption(requestHandle, Interop.
WinHttp
.WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE, ref optionData);
1515
uint optionData = (requestVersion == HttpVersion20) ? Interop.
WinHttp
.WINHTTP_PROTOCOL_FLAG_HTTP2 : 0;
1516
if (Interop.
WinHttp
.WinHttpSetOption(
1518
Interop.
WinHttp
.WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL,
1532
if (!Interop.
WinHttp
.WinHttpSetOption(
1537
WinHttpException.ThrowExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpSetOption));
1548
if (!Interop.
WinHttp
.WinHttpSetOption(
1554
WinHttpException.ThrowExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpSetOption));
1614
Interop.
WinHttp
.WINHTTP_STATUS_CALLBACK callback)
1617
Interop.
WinHttp
.WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS |
1618
Interop.
WinHttp
.WINHTTP_CALLBACK_FLAG_HANDLES |
1619
Interop.
WinHttp
.WINHTTP_CALLBACK_FLAG_REDIRECT |
1620
Interop.
WinHttp
.WINHTTP_CALLBACK_FLAG_SEND_REQUEST |
1621
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER;
1623
IntPtr oldCallback = Interop.
WinHttp
.WinHttpSetStatusCallback(
1629
if (oldCallback == new IntPtr(Interop.
WinHttp
.WINHTTP_INVALID_STATUS_CALLBACK))
1632
if (lastError != Interop.
WinHttp
.ERROR_INVALID_HANDLE) // Ignore error if handle was already closed.
1634
throw WinHttpException.CreateExceptionUsingError(lastError, nameof(Interop.
WinHttp
.WinHttpSetStatusCallback));
1659
if (!Interop.
WinHttp
.WinHttpSendRequest(
1674
WinHttpException.ThrowExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpSendRequest));
1699
if (!Interop.
WinHttp
.WinHttpReceiveResponse(state.RequestHandle, IntPtr.Zero))
1701
throw WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpReceiveResponse));
System\Net\Http\WinHttpRequestCallback.cs (41)
16
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
27
public static Interop.
WinHttp
.WINHTTP_STATUS_CALLBACK StaticCallbackDelegate =
28
new Interop.
WinHttp
.WINHTTP_STATUS_CALLBACK(WinHttpCallback);
66
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER:
74
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING:
78
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
82
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE:
88
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_READ_COMPLETE:
92
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE:
96
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
100
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_REDIRECT:
105
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_SENDING_REQUEST:
109
case Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
111
statusInformationLength == Marshal.SizeOf<Interop.
WinHttp
.WINHTTP_ASYNC_RESULT>(),
113
" must be sizeof(WINHTTP_ASYNC_RESULT)=" + Marshal.SizeOf<Interop.
WinHttp
.WINHTTP_ASYNC_RESULT>());
115
var asyncResult = Marshal.PtrToStructure<Interop.
WinHttp
.WINHTTP_ASYNC_RESULT>(statusInformation);
284
if (!Interop.
WinHttp
.WinHttpQueryOption(
286
Interop.
WinHttp
.WINHTTP_OPTION_SERVER_CERT_CONTEXT,
293
if (lastError == Interop.
WinHttp
.ERROR_WINHTTP_INCORRECT_HANDLE_STATE)
319
Interop.
WinHttp
.WINHTTP_CONNECTION_INFO connectionInfo;
320
Interop.
WinHttp
.WINHTTP_CONNECTION_INFO* pConnectionInfo = &connectionInfo;
321
uint infoSize = (uint)sizeof(Interop.
WinHttp
.WINHTTP_CONNECTION_INFO);
322
if (Interop.
WinHttp
.WinHttpQueryOption(
325
Interop.
WinHttp
.WINHTTP_OPTION_CONNECTION_INFO,
422
(int)Interop.
WinHttp
.ERROR_WINHTTP_SECURE_FAILURE, "X509Chain.Build", ex);
433
(int)Interop.
WinHttp
.ERROR_WINHTTP_SECURE_FAILURE, "ServerCertificateValidationCallback");
438
private static void OnRequestError(WinHttpRequestState state, Interop.
WinHttp
.WINHTTP_ASYNC_RESULT asyncResult)
448
case Interop.
WinHttp
.API_SEND_REQUEST:
452
case Interop.
WinHttp
.API_RECEIVE_RESPONSE:
453
if (asyncResult.dwError == Interop.
WinHttp
.ERROR_WINHTTP_RESEND_REQUEST)
458
else if (asyncResult.dwError == Interop.
WinHttp
.ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED)
470
else if (asyncResult.dwError == Interop.
WinHttp
.ERROR_WINHTTP_OPERATION_CANCELLED)
480
case Interop.
WinHttp
.API_QUERY_DATA_AVAILABLE:
481
if (asyncResult.dwError == Interop.
WinHttp
.ERROR_WINHTTP_OPERATION_CANCELLED)
493
case Interop.
WinHttp
.API_READ_DATA:
494
if (asyncResult.dwError == Interop.
WinHttp
.ERROR_WINHTTP_OPERATION_CANCELLED)
505
case Interop.
WinHttp
.API_WRITE_DATA:
507
if (asyncResult.dwError == Interop.
WinHttp
.ERROR_WINHTTP_OPERATION_CANCELLED)
534
if (!Interop.
WinHttp
.WinHttpAddRequestHeaders(
538
Interop.
WinHttp
.WINHTTP_ADDREQ_FLAG_REPLACE))
541
if (lastError != Interop.
WinHttp
.ERROR_WINHTTP_HEADER_NOT_FOUND)
System\Net\Http\WinHttpRequestState.cs (1)
13
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
System\Net\Http\WinHttpRequestStream.cs (5)
11
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
230
if (!Interop.
WinHttp
.WinHttpWriteData(
237
new IOException(SR.net_http_io_write, WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpWriteData))));
251
if (!Interop.
WinHttp
.WinHttpWriteData(
258
new IOException(SR.net_http_io_write, WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpWriteData))));
System\Net\Http\WinHttpResponseParser.cs (29)
12
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
43
int versionLength = GetResponseHeader(requestHandle, Interop.
WinHttp
.WINHTTP_QUERY_VERSION, buffer);
53
Interop.
WinHttp
.WINHTTP_QUERY_STATUS_CODE);
55
int reasonPhraseLength = GetResponseHeader(requestHandle, Interop.
WinHttp
.WINHTTP_QUERY_STATUS_TEXT, buffer);
90
if (!Interop.
WinHttp
.WinHttpQueryHeaders(
92
infoLevel | Interop.
WinHttp
.WINHTTP_QUERY_FLAG_NUMBER,
93
Interop.
WinHttp
.WINHTTP_HEADER_NAME_BY_INDEX,
98
WinHttpException.ThrowExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpQueryHeaders));
143
if (lastError == Interop.
WinHttp
.ERROR_WINHTTP_HEADER_NOT_FOUND)
149
if (lastError == Interop.
WinHttp
.ERROR_INSUFFICIENT_BUFFER)
169
throw WinHttpException.CreateExceptionUsingError(lastError, nameof(Interop.
WinHttp
.WinHttpQueryHeaders));
189
if (lastError == Interop.
WinHttp
.ERROR_WINHTTP_HEADER_NOT_FOUND)
194
Debug.Assert(lastError != Interop.
WinHttp
.ERROR_INSUFFICIENT_BUFFER, "buffer must be of sufficient size.");
196
throw WinHttpException.CreateExceptionUsingError(lastError, nameof(Interop.
WinHttp
.WinHttpQueryHeaders));
212
uint infoLevel = Interop.
WinHttp
.WINHTTP_QUERY_RAW_HEADERS_CRLF;
215
infoLevel |= Interop.
WinHttp
.WINHTTP_QUERY_FLAG_TRAILERS;
222
Debug.Assert(isTrailingHeaders || lastError != Interop.
WinHttp
.ERROR_WINHTTP_HEADER_NOT_FOUND);
224
if (lastError != Interop.
WinHttp
.ERROR_INSUFFICIENT_BUFFER &&
225
(!isTrailingHeaders || lastError != Interop.
WinHttp
.ERROR_WINHTTP_HEADER_NOT_FOUND))
227
throw WinHttpException.CreateExceptionUsingError(lastError, nameof(Interop.
WinHttp
.WinHttpQueryHeaders));
248
bool result = Interop.
WinHttp
.WinHttpQueryHeaders(
251
Interop.
WinHttp
.WINHTTP_HEADER_NAME_BY_INDEX,
287
Interop.
WinHttp
.WINHTTP_QUERY_RAW_HEADERS_CRLF,
327
Interop.
WinHttp
.WINHTTP_QUERY_RAW_HEADERS_CRLF | Interop.
WinHttp
.WINHTTP_QUERY_FLAG_TRAILERS,
344
if (Interop.
WinHttp
.WinHttpQueryOption(
346
Interop.
WinHttp
.WINHTTP_OPTION_HTTP_PROTOCOL_USED,
350
if ((data & Interop.
WinHttp
.WINHTTP_PROTOCOL_FLAG_HTTP2) != 0)
352
if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(requestHandle, nameof(Interop.
WinHttp
.WINHTTP_PROTOCOL_FLAG_HTTP2));
System\Net\Http\WinHttpResponseStream.cs (9)
11
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
124
if (!Interop.
WinHttp
.WinHttpQueryDataAvailable(_requestHandle, IntPtr.Zero))
126
throw new IOException(SR.net_http_io_read, WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpQueryDataAvailable)));
141
if (!Interop.
WinHttp
.WinHttpReadData(_requestHandle, Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0), (uint)Math.Min(bytesAvailable, buffer.Length), IntPtr.Zero))
143
throw new IOException(SR.net_http_io_read, WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpReadData)));
225
if (!Interop.
WinHttp
.WinHttpQueryDataAvailable(_requestHandle, IntPtr.Zero))
227
throw new IOException(SR.net_http_io_read, WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpQueryDataAvailable)));
236
if (!Interop.
WinHttp
.WinHttpReadData(
242
throw new IOException(SR.net_http_io_read, WinHttpException.CreateExceptionUsingLastError(nameof(Interop.
WinHttp
.WinHttpReadData)));
System\Net\Http\WinHttpTraceHelper.cs (46)
22
public static void TraceAsyncError(object thisOrContextObject, Interop.
WinHttp
.WINHTTP_ASYNC_RESULT asyncResult, [CallerMemberName] string? memberName = null)
38
Interop.
WinHttp
.API_RECEIVE_RESPONSE => "API_RECEIVE_RESPONSE",
39
Interop.
WinHttp
.API_QUERY_DATA_AVAILABLE => "API_QUERY_DATA_AVAILABLE",
40
Interop.
WinHttp
.API_READ_DATA => "API_READ_DATA",
41
Interop.
WinHttp
.API_WRITE_DATA => "API_WRITE_DATA",
42
Interop.
WinHttp
.API_SEND_REQUEST => "API_SEND_REQUEST",
49
Interop.
WinHttp
.ERROR_FILE_NOT_FOUND => "ERROR_FILE_NOT_FOUND",
50
Interop.
WinHttp
.ERROR_INVALID_HANDLE => "ERROR_INVALID_HANDLE",
51
Interop.
WinHttp
.ERROR_INVALID_PARAMETER => "ERROR_INVALID_PARAMETER",
52
Interop.
WinHttp
.ERROR_INSUFFICIENT_BUFFER => "ERROR_INSUFFICIENT_BUFFER",
53
Interop.
WinHttp
.ERROR_NOT_FOUND => "ERROR_NOT_FOUND",
54
Interop.
WinHttp
.ERROR_WINHTTP_INVALID_OPTION => "WINHTTP_INVALID_OPTION",
55
Interop.
WinHttp
.ERROR_WINHTTP_LOGIN_FAILURE => "WINHTTP_LOGIN_FAILURE",
56
Interop.
WinHttp
.ERROR_WINHTTP_OPERATION_CANCELLED => "WINHTTP_OPERATION_CANCELLED",
57
Interop.
WinHttp
.ERROR_WINHTTP_INCORRECT_HANDLE_STATE => "WINHTTP_INCORRECT_HANDLE_STATE",
58
Interop.
WinHttp
.ERROR_WINHTTP_CONNECTION_ERROR => "WINHTTP_CONNECTION_ERROR",
59
Interop.
WinHttp
.ERROR_WINHTTP_RESEND_REQUEST => "WINHTTP_RESEND_REQUEST",
60
Interop.
WinHttp
.ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED => "WINHTTP_CLIENT_AUTH_CERT_NEEDED",
61
Interop.
WinHttp
.ERROR_WINHTTP_HEADER_NOT_FOUND => "WINHTTP_HEADER_NOT_FOUND",
62
Interop.
WinHttp
.ERROR_WINHTTP_SECURE_FAILURE => "WINHTTP_SECURE_FAILURE",
63
Interop.
WinHttp
.ERROR_WINHTTP_AUTODETECTION_FAILED => "WINHTTP_AUTODETECTION_FAILED",
70
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_RESOLVING_NAME => "STATUS_RESOLVING_NAME",
71
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_NAME_RESOLVED => "STATUS_NAME_RESOLVED",
72
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER => "STATUS_CONNECTING_TO_SERVER",
73
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER => "STATUS_CONNECTED_TO_SERVER",
74
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_SENDING_REQUEST => "STATUS_SENDING_REQUEST",
75
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_REQUEST_SENT => "STATUS_REQUEST_SENT",
76
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE => "STATUS_RECEIVING_RESPONSE",
77
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED => "STATUS_RESPONSE_RECEIVED",
78
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION => "STATUS_CLOSING_CONNECTION",
79
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED => "STATUS_CONNECTION_CLOSED",
80
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_HANDLE_CREATED => "STATUS_HANDLE_CREATED",
81
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING => "STATUS_HANDLE_CLOSING",
82
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_DETECTING_PROXY => "STATUS_DETECTING_PROXY",
83
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_REDIRECT => "STATUS_REDIRECT",
84
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE => "STATUS_INTERMEDIATE_RESPONSE",
85
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_SECURE_FAILURE => "STATUS_SECURE_FAILURE",
86
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE => "STATUS_HEADERS_AVAILABLE",
87
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE => "STATUS_DATA_AVAILABLE",
88
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_READ_COMPLETE => "STATUS_READ_COMPLETE",
89
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE => "STATUS_WRITE_COMPLETE",
90
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_REQUEST_ERROR => "STATUS_REQUEST_ERROR",
91
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE => "STATUS_SENDREQUEST_COMPLETE",
92
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE => "STATUS_GETPROXYFORURL_COMPLETE",
93
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE => "STATUS_CLOSE_COMPLETE",
94
Interop.
WinHttp
.WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE => "STATUS_SHUTDOWN_COMPLETE",
System\Net\Http\WinHttpTrailersHelper.cs (9)
7
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;
41
using SafeWinHttpHandle sessionHandle = Interop.
WinHttp
.WinHttpOpen(
43
Interop.
WinHttp
.WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
44
Interop.
WinHttp
.WINHTTP_NO_PROXY_NAME,
45
Interop.
WinHttp
.WINHTTP_NO_PROXY_BYPASS,
46
(int)Interop.
WinHttp
.WINHTTP_FLAG_ASYNC);
51
if (Interop.
WinHttp
.WinHttpQueryOption(sessionHandle, Interop.
WinHttp
.WINHTTP_OPTION_STREAM_ERROR_CODE, ref buffer, ref bufferSize))
61
return lastError != Interop.
WinHttp
.ERROR_INVALID_PARAMETER;
System\Net\Http\WinHttpTransportContext.cs (1)
7
using SafeWinHttpHandle = Interop.
WinHttp
.SafeWinHttpHandle;