Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 9adfd30

Browse files
ErikMogensennemakam
authored andcommitted
Enable use of the proxy (#668)
I believe this fixes #436 It has been been tested running in .NET Framework 4.7.2 and .NET Core 2.1 on Windows. It is assumed that the proxy is only used in transportMode=AmqpWebSockets.
1 parent 69860ed commit 9adfd30

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Microsoft.Azure.ServiceBus/Amqp/AmqpConnectionHelper.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace Microsoft.Azure.ServiceBus.Amqp
55
{
66
using System;
7+
using System.Net;
78
using Microsoft.Azure.Amqp;
89
using Microsoft.Azure.Amqp.Sasl;
910
using Microsoft.Azure.Amqp.Transport;
@@ -101,7 +102,8 @@ public static TransportSettings CreateTcpTransportSettings(
101102
public static TransportSettings CreateWebSocketTransportSettings(
102103
string networkHost,
103104
string hostName,
104-
int port)
105+
int port,
106+
IWebProxy proxy)
105107
{
106108
var uriBuilder = new UriBuilder(
107109
WebSocketConstants.WebSocketSecureScheme,
@@ -112,7 +114,8 @@ public static TransportSettings CreateWebSocketTransportSettings(
112114
{
113115
Uri = uriBuilder.Uri,
114116
ReceiveBufferSize = AmqpConstants.TransportBufferSize,
115-
SendBufferSize = AmqpConstants.TransportBufferSize
117+
SendBufferSize = AmqpConstants.TransportBufferSize,
118+
Proxy = proxy
116119
};
117120

118121
TransportSettings tpSettings = webSocketTransportSettings;

src/Microsoft.Azure.ServiceBus/ServiceBusConnection.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace Microsoft.Azure.ServiceBus
55
{
66
using System;
7+
using System.Net;
78
using System.Threading.Tasks;
89
using Microsoft.Azure.Amqp;
910
using Microsoft.Azure.Amqp.Framing;
@@ -309,7 +310,8 @@ TransportSettings CreateTransportSettings()
309310
return AmqpConnectionHelper.CreateWebSocketTransportSettings(
310311
networkHost: networkHost,
311312
hostName: hostName,
312-
port: port);
313+
port: port,
314+
proxy: WebRequest.DefaultWebProxy);
313315
}
314316

315317
return AmqpConnectionHelper.CreateTcpTransportSettings(

0 commit comments

Comments
 (0)