Skip to content

ClientWebSocket not using system proxy settings on Windows #26891

@davidsh

Description

@davidsh

This appears to be a bug in HttpSystemProxy class used in SocketsHttpHandler. The problem might not be isolated to just ClientWebSocket. But the parser in ParseProxyConfig doesn't seem to be able to handle simple "host:port" strings that are in IE settings.

https://github.com/dotnet/corefx/blob/3ea1a8cf78073491f9532e36a738a7b8be44829a/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpSystemProxy.cs#L214

Repro Code:

//using System;
//using System.IO;
//using System.Net;
//using System.Net.Http;
//using System.Net.WebSockets;
//using System.Threading;

var uri = new Uri("wss://corefx-net.cloudapp.net/websocket/echowebsocket.ashx");
var socket = new ClientWebSocket();
socket.ConnectAsync(uri, CancellationToken.None).GetAwaiter().GetResult();

IE Settings example:
image

I debugged this to the ParseProxyConfig() method. It is getting a value of "localhost:3128". But ends up returning null URIs. So, the proxy is ignored.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions