60 Proxy = DefaultWebProxy.Instance
94 if (
options.Credentials ==
null && !
options.UseDefaultCredentials &&
options.Proxy ==
null &&
options.Cookies ==
null &&
options.RemoteCertificateValidationCallback ==
null)
122 UseCookies = (options.Cookies !=
null),
125 RemoteCertificateValidationCallback = options.RemoteCertificateValidationCallback
128 if (
options.UseDefaultCredentials)
134 handler.Credentials =
options.Credentials;
138 handler.UseProxy =
false;
181 if (
array.Length != 0 && !
string.IsNullOrEmpty(
array[0]))
183 if (
options._requestedSubProtocols !=
null)
206 if (
readOnlySpan.TrimStart().StartsWith(
"permessage-deflate"))
270 if (
readOnlySpan2.SequenceEqual(
"client_no_context_takeover"))
272 webSocketDeflateOptions.ClientContextTakeover =
false;
274 else if (
readOnlySpan2.SequenceEqual(
"server_no_context_takeover"))
276 webSocketDeflateOptions.ServerContextTakeover =
false;
316 request.Headers.TryAddWithoutValidation(
"Connection",
"Upgrade");
317 request.Headers.TryAddWithoutValidation(
"Upgrade",
"websocket");
318 request.Headers.TryAddWithoutValidation(
"Sec-WebSocket-Version",
"13");
319 request.Headers.TryAddWithoutValidation(
"Sec-WebSocket-Key",
secKey);
323 request.Headers.TryAddWithoutValidation(
"Sec-WebSocket-Protocol",
string.
Join(
", ",
options.RequestedSubProtocols));
325 if (
options.DangerousDeflateOptions !=
null)
333 if (
options.ClientMaxWindowBits != 15)
349 if (!
options.ClientContextTakeover)
351 stringBuilder.Append(
"; ").Append(
"client_no_context_takeover");
353 if (
options.ServerMaxWindowBits != 15)
361 handler2.AppendFormatted(
"server_max_window_bits");
366 if (!
options.ServerContextTakeover)
368 stringBuilder.Append(
"; ").Append(
"server_no_context_takeover");
380 for (
int i = 0; i <
text.Length; i++)
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
Enumerator GetEnumerator()
static string ToBase64String(byte[] inArray)
static CultureInfo InvariantCulture
static ICredentials DefaultCredentials
virtual Task< HttpResponseMessage > SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
SslClientAuthenticationOptions SslOptions
override void Dispose(bool disposing)
TimeSpan KeepAliveInterval
static DefaultWebProxy Instance
Uri GetProxy(Uri destination)
bool IsBypassed(Uri host)
static void AddWebSocketHeaders(HttpRequestMessage request, string secKey, ClientWebSocketOptions options)
WebSocketDeflateOptions _negotiatedDeflateOptions
static KeyValuePair< string, string > CreateSecKeyAndSecWebSocketAccept()
static ClientWebSocketOptions CreateDefaultOptions()
static WebSocketDeflateOptions ParseDeflateOptions(ReadOnlySpan< char > extension, WebSocketDeflateOptions original)
static SocketsHttpHandler s_defaultHandler
async Task ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
static void ValidateHeader(HttpHeaders headers, string name, string expectedValue)
readonly CancellationTokenSource _abortSource
static WebSocket CreateFromStream(Stream stream, bool isServer, string? subProtocol, TimeSpan keepAliveInterval)
static string net_WebSockets_AcceptUnsupportedProtocol
static string net_WebSockets_MissingResponseHeader
static string net_WebSockets_InvalidResponseHeader
static string Format(string resourceFormat, object p1)
static string net_WebSockets_ServerWindowBitsNegotiationFailure
static string net_WebSockets_ClientWindowBitsNegotiationFailure
static string net_webstatus_ConnectFailure
static string net_WebSockets_Connect101Expected
static bool TryHashData(ReadOnlySpan< byte > source, Span< byte > destination, out int bytesWritten)
static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token1, CancellationToken token2)
static int CompareExchange(ref int location1, int value, int comparand)
void AppendLiteral(string value)
void AppendFormatted(ReadOnlySpan< char > value)
static readonly TimeSpan Zero