mirror of https://github.com/eclipse/paho.mqtt.c
Ignore HTTP proxies by default #1344
This commit is contained in:
parent
b92e506ebc
commit
81069aa52c
|
|
@ -78,6 +78,7 @@
|
|||
* <li>@ref tracing</li>
|
||||
* <li>@ref auto_reconnect</li>
|
||||
* <li>@ref offline_publish</li>
|
||||
* <li>@ref HTTP_proxies</li>
|
||||
* </ul>
|
||||
* @endcond
|
||||
*/
|
||||
|
|
@ -1374,11 +1375,13 @@ typedef struct
|
|||
*/
|
||||
const MQTTAsync_nameValue* httpHeaders;
|
||||
/**
|
||||
* HTTP proxy
|
||||
*/
|
||||
* The string value of the HTTP proxy. Examples:
|
||||
* - http://your.proxy.server:8080/
|
||||
* - http://user:pass@my.proxy.server:8080/
|
||||
*/
|
||||
const char* httpProxy;
|
||||
/**
|
||||
* HTTPS proxy
|
||||
* HTTPS proxy setting. See ::MQTTAsync_connectOptions.httpProxy and the section @ref HTTP_proxies.
|
||||
*/
|
||||
const char* httpsProxy;
|
||||
} MQTTAsync_connectOptions;
|
||||
|
|
@ -2377,6 +2380,17 @@ exit:
|
|||
20130528 163909.209 Heap scan end
|
||||
* @endcode
|
||||
* @endcond
|
||||
*
|
||||
√* @page HTTP_proxies HTTP Proxies
|
||||
* The use of HTTP proxies can be controlled by environment variables or API calls.
|
||||
*
|
||||
* The ::MQTTAsync_connectOptions.httpProxy and ::MQTTAsync_connectOptions.httpsProxy fields
|
||||
* of the ::MQTTAsync_connectOptions structure override any settings in the environment.
|
||||
*
|
||||
* If the environment variable PAHO_C_CLIENT_USE_HTTP_PROXY is set to TRUE, then the
|
||||
* http_proxy or https_proxy environment variables are used, for plain TCP and TLS-secured
|
||||
* connections respectively.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@
|
|||
* <li>@ref wildcard</li>
|
||||
* <li>@ref qos</li>
|
||||
* <li>@ref tracing</li>
|
||||
* <li>@ref HTTP_proxies</li>
|
||||
* </ul>
|
||||
* @endcond
|
||||
*/
|
||||
|
|
@ -971,12 +972,14 @@ typedef struct
|
|||
*/
|
||||
const MQTTClient_nameValue* httpHeaders;
|
||||
/**
|
||||
* HTTP proxy
|
||||
*/
|
||||
* The string value of the HTTP proxy. Examples:
|
||||
* - http://your.proxy.server:8080/
|
||||
* - http://user:pass@my.proxy.server:8080/
|
||||
*/
|
||||
const char* httpProxy;
|
||||
/**
|
||||
* HTTPS proxy
|
||||
*/
|
||||
* HTTPS proxy setting. See ::MQTTClient_connectOptions.httpProxy and the section @ref HTTP_proxies.
|
||||
*/
|
||||
const char* httpsProxy;
|
||||
} MQTTClient_connectOptions;
|
||||
|
||||
|
|
@ -1979,4 +1982,15 @@ exit:
|
|||
20130528 163909.209 Heap scan end
|
||||
* @endcode
|
||||
* @endcond
|
||||
*
|
||||
* √* @page HTTP_proxies HTTP Proxies
|
||||
* The use of HTTP proxies can be controlled by environment variables or API calls.
|
||||
*
|
||||
* The ::MQTTClient_connectOptions.httpProxy and ::MQTTClient_connectOptions.httpsProxy fields
|
||||
* of the ::MQTTClient_connectOptions structure override any settings in the environment.
|
||||
*
|
||||
* If the environment variable PAHO_C_CLIENT_USE_HTTP_PROXY is set to TRUE, then the
|
||||
* http_proxy or https_proxy environment variables are used, for plain TCP and TLS-secured
|
||||
* connections respectively.
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ int MQTTProtocol_connect(const char* ip_address, Clients* aClient, int websocket
|
|||
int rc = 0,
|
||||
port;
|
||||
size_t addr_len;
|
||||
char* p0;
|
||||
char* p0 = NULL;
|
||||
|
||||
FUNC_ENTRY;
|
||||
aClient->good = 1;
|
||||
|
|
@ -230,7 +230,15 @@ int MQTTProtocol_connect(const char* ip_address, Clients* aClient, int websocket
|
|||
if (aClient->httpProxy)
|
||||
p0 = aClient->httpProxy;
|
||||
else
|
||||
p0 = getenv("http_proxy");
|
||||
{
|
||||
/* Don't use the environment HTTP proxy settings by default - for backwards compatibility */
|
||||
char* use_proxy = getenv("PAHO_C_CLIENT_USE_HTTP_PROXY");
|
||||
if (use_proxy)
|
||||
{
|
||||
if (strncmp(use_proxy, "TRUE", strlen("TRUE")) == 0)
|
||||
p0 = getenv("http_proxy");
|
||||
}
|
||||
}
|
||||
|
||||
if (p0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue