From 1ec6c546cf11ae559ce8c147f4812446686586a8 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Wed, 7 Aug 2024 11:41:01 -0700 Subject: [PATCH] Proxy fix (#647) Co-authored-by: Ryan Smith --- source/iot/Mqtt5Client.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/iot/Mqtt5Client.cpp b/source/iot/Mqtt5Client.cpp index 46aaa8e29..e9cc5226e 100644 --- a/source/iot/Mqtt5Client.cpp +++ b/source/iot/Mqtt5Client.cpp @@ -571,6 +571,8 @@ namespace Aws m_options->WithConnectOptions(m_connectOptions); } + bool proxyOptionsSet = false; + if (m_websocketConfig.has_value()) { auto websocketConfig = m_websocketConfig.value(); @@ -595,13 +597,20 @@ namespace Aws if (useWebsocketProxyOptions) { m_options->WithHttpProxyOptions(m_websocketConfig->ProxyOptions.value()); + proxyOptionsSet = true; } else if (m_proxyOptions.has_value()) { m_options->WithHttpProxyOptions(m_proxyOptions.value()); + proxyOptionsSet = true; } } + if (m_proxyOptions.has_value() && !proxyOptionsSet) + { + m_options->WithHttpProxyOptions(m_proxyOptions.value()); + } + return Crt::Mqtt5::Mqtt5Client::NewMqtt5Client(*m_options, m_allocator); }