Merge branch 'develop' of github.com:pluraf/paho.mqtt.c into pluraf-develop

This commit is contained in:
Ian Craggs 2025-08-15 15:41:20 +01:00
commit 3a076d7d33
No known key found for this signature in database
GPG Key ID: A7AE1A8F2CCAB186
4 changed files with 38 additions and 4 deletions

View File

@ -335,6 +335,7 @@ int MQTTAsync_createWithOptions(MQTTAsync* handle, const char* serverURI, const
&& strncmp(URI_WS, serverURI, strlen(URI_WS)) != 0
#if defined(OPENSSL)
&& strncmp(URI_SSL, serverURI, strlen(URI_SSL)) != 0
&& strncmp(URI_TLS, serverURI, strlen(URI_TLS)) != 0
&& strncmp(URI_MQTTS, serverURI, strlen(URI_MQTTS)) != 0
&& strncmp(URI_WSS, serverURI, strlen(URI_WSS)) != 0
#endif
@ -405,6 +406,11 @@ int MQTTAsync_createWithOptions(MQTTAsync* handle, const char* serverURI, const
serverURI += strlen(URI_SSL);
m->ssl = 1;
}
else if (strncmp(URI_TLS, serverURI, strlen(URI_TLS)) == 0)
{
serverURI += strlen(URI_TLS);
m->ssl = 1;
}
else if (strncmp(URI_MQTTS, serverURI, strlen(URI_MQTTS)) == 0)
{
serverURI += strlen(URI_MQTTS);

View File

@ -1348,6 +1348,11 @@ static int MQTTAsync_processCommand(void)
serverURI += strlen(URI_SSL);
command->client->ssl = 1;
}
else if (strncmp(URI_TLS, serverURI, strlen(URI_TLS)) == 0)
{
serverURI += strlen(URI_TLS);
command->client->ssl = 1;
}
else if (strncmp(URI_MQTTS, serverURI, strlen(URI_MQTTS)) == 0)
{
serverURI += strlen(URI_MQTTS);
@ -2896,6 +2901,11 @@ static int MQTTAsync_connecting(MQTTAsyncs* m)
serverURI += strlen(URI_SSL);
default_port = SECURE_MQTT_DEFAULT_PORT;
}
else if (strncmp(URI_TLS, serverURI, strlen(URI_TLS)) == 0)
{
serverURI += strlen(URI_TLS);
default_port = SECURE_MQTT_DEFAULT_PORT;
}
else if (strncmp(URI_MQTTS, serverURI, strlen(URI_MQTTS)) == 0)
{
serverURI += strlen(URI_MQTTS);

View File

@ -71,6 +71,7 @@
#include <openssl/ssl.h>
#else
#define URI_SSL "ssl://"
#define URI_TLS "tls://"
#define URI_MQTTS "mqtts://"
#endif
@ -403,6 +404,7 @@ int MQTTClient_createWithOptions(MQTTClient* handle, const char* serverURI, cons
&& strncmp(URI_WS, serverURI, strlen(URI_WS)) != 0
#if defined(OPENSSL)
&& strncmp(URI_SSL, serverURI, strlen(URI_SSL)) != 0
&& strncmp(URI_TLS, serverURI, strlen(URI_TLS)) != 0
&& strncmp(URI_MQTTS, serverURI, strlen(URI_MQTTS)) != 0
&& strncmp(URI_WSS, serverURI, strlen(URI_WSS)) != 0
#endif
@ -465,6 +467,16 @@ int MQTTClient_createWithOptions(MQTTClient* handle, const char* serverURI, cons
#else
rc = MQTTCLIENT_SSL_NOT_SUPPORTED;
goto exit;
#endif
}
else if (strncmp(URI_TLS, serverURI, strlen(URI_TLS)) == 0)
{
#if defined(OPENSSL)
serverURI += strlen(URI_TLS);
m->ssl = 1;
#else
rc = MQTTCLIENT_SSL_NOT_SUPPORTED;
goto exit;
#endif
}
else if (strncmp(URI_MQTTS, serverURI, strlen(URI_MQTTS)) == 0)
@ -1898,6 +1910,11 @@ MQTTResponse MQTTClient_connectAll(MQTTClient handle, MQTTClient_connectOptions*
serverURI += strlen(URI_SSL);
m->ssl = 1;
}
else if (strncmp(URI_TLS, serverURI, strlen(URI_TLS)) == 0)
{
serverURI += strlen(URI_TLS);
m->ssl = 1;
}
else if (strncmp(URI_MQTTS, serverURI, strlen(URI_MQTTS)) == 0)
{
serverURI += strlen(URI_MQTTS);

View File

@ -3,15 +3,15 @@
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* The Eclipse Public License is available at
* https://www.eclipse.org/legal/epl-2.0/
* and the Eclipse Distribution License is available at
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Ian Craggs, Allan Stockdill-Mander - initial implementation
* Ian Craggs, Allan Stockdill-Mander - initial implementation
* Ian Craggs - SNI support
* Ian Craggs - post connect checks and CApath
*******************************************************************************/
@ -31,6 +31,7 @@
#include "Clients.h"
#define URI_SSL "ssl://"
#define URI_TLS "tls://"
#define URI_MQTTS "mqtts://"
/** if we should handle openssl initialization (bool_value == 1) or depend on it to be initalized externally (bool_value == 0) */