mqtt: enable by default

No longer considered experimental.

Closes #5858
This commit is contained in:
Daniel Stenberg 2020-08-31 09:45:09 +02:00
parent ede125b7b7
commit e37e446868
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
11 changed files with 113 additions and 111 deletions

View File

@ -80,8 +80,6 @@ jobs:
- env:
- T=normal C="--enable-ares"
- OVERRIDE_CC="CC=gcc-8" OVERRIDE_CXX="CXX=g++-8"
- env:
- T=normal C="--enable-mqtt"
- env:
- T=normal C="--disable-proxy"
- env:

View File

@ -190,8 +190,8 @@ option(CURL_DISABLE_SMTP "to disable SMTP" OFF)
mark_as_advanced(CURL_DISABLE_SMTP)
option(CURL_DISABLE_GOPHER "to disable Gopher" OFF)
mark_as_advanced(CURL_DISABLE_GOPHER)
option(CURL_ENABLE_MQTT "to enable MQTT" OFF)
mark_as_advanced(CURL_ENABLE_MQTT)
option(CURL_DISABLE_MQTT "to disable MQTT" OFF)
mark_as_advanced(CURL_DISABLE_MQTT)
if(HTTP_ONLY)
set(CURL_DISABLE_FTP ON)
@ -1419,7 +1419,7 @@ _add_if("SCP" USE_LIBSSH2 OR USE_LIBSSH)
_add_if("SFTP" USE_LIBSSH2 OR USE_LIBSSH)
_add_if("RTSP" NOT CURL_DISABLE_RTSP)
_add_if("RTMP" USE_LIBRTMP)
_add_if("MQTT" CURL_ENABLE_MQTT)
_add_if("MQTT" NOT CURL_DISABLE_MQTT)
if(_items)
list(SORT _items)
endif()

View File

@ -645,11 +645,10 @@ AC_HELP_STRING([--disable-mqtt],[Disable MQTT support]),
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_MQTT, 1, [to disable MQTT])
AC_SUBST(CURL_DISABLE_MQTT, [1])
;;
*) AC_MSG_RESULT(yes)
experimental="$experimental MQTT"
AC_DEFINE(CURL_ENABLE_MQTT, 1, [to enable MQTT])
AC_SUBST(CURL_ENABLE_MQTT, [1])
;;
esac ],
AC_MSG_RESULT(no)
@ -5082,7 +5081,7 @@ fi
if test "x$CURL_DISABLE_GOPHER" != "x1"; then
SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
fi
if test "x$CURL_ENABLE_MQTT" = "x1"; then
if test "x$CURL_DISABLE_MQTT" != "x1"; then
SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS MQTT"
fi
if test "x$CURL_DISABLE_POP3" != "x1"; then

View File

@ -62,6 +62,10 @@ Disable the --libcurl option from the curl tool.
Disable MIME support.
## CURL_DISABLE_MQTT
Disable MQTT support.
## CURL_DISABLE_NETRC
Disable the netrc parser.

View File

@ -20,5 +20,4 @@ Experimental support in curl means:
- HTTP/3 support and options
- alt-svc support and options
- MQTT
- CURLSSLOPT_NATIVE_CA (No configure option, feature built in when supported)

View File

@ -63,8 +63,8 @@
/* to disable LDAPS */
#cmakedefine CURL_DISABLE_LDAPS 1
/* to enable MQTT */
#undef CURL_ENABLE_MQTT
/* to disable MQTT */
#cmakedefine CURL_DISABLE_MQTT 1
/* to disable POP3 */
#cmakedefine CURL_DISABLE_POP3 1

View File

@ -23,7 +23,7 @@
#include "curl_setup.h"
#ifdef CURL_ENABLE_MQTT
#ifndef CURL_DISABLE_MQTT
#include "urldata.h"
#include <curl/curl.h>
@ -625,4 +625,4 @@ static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
return result;
}
#endif /* CURL_ENABLE_MQTT */
#endif /* CURL_DISABLE_MQTT */

View File

@ -22,7 +22,7 @@
*
***************************************************************************/
#ifdef CURL_ENABLE_MQTT
#ifndef CURL_DISABLE_MQTT
extern const struct Curl_handler Curl_handler_mqtt;
#endif

View File

@ -434,100 +434,8 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
#endif
break;
#ifndef CURL_DISABLE_HTTP
case CURLOPT_AUTOREFERER:
/*
* Switch on automatic referer that gets set if curl follows locations.
*/
data->set.http_auto_referer = (0 != va_arg(param, long)) ? TRUE : FALSE;
break;
case CURLOPT_ACCEPT_ENCODING:
/*
* String to use at the value of Accept-Encoding header.
*
* If the encoding is set to "" we use an Accept-Encoding header that
* encompasses all the encodings we support.
* If the encoding is set to NULL we don't send an Accept-Encoding header
* and ignore an received Content-Encoding header.
*
*/
argptr = va_arg(param, char *);
if(argptr && !*argptr) {
argptr = Curl_all_content_encodings();
if(!argptr)
result = CURLE_OUT_OF_MEMORY;
else {
result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
free(argptr);
}
}
else
result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
break;
case CURLOPT_TRANSFER_ENCODING:
data->set.http_transfer_encoding = (0 != va_arg(param, long)) ?
TRUE : FALSE;
break;
case CURLOPT_FOLLOWLOCATION:
/*
* Follow Location: header hints on a HTTP-server.
*/
data->set.http_follow_location = (0 != va_arg(param, long)) ? TRUE : FALSE;
break;
case CURLOPT_UNRESTRICTED_AUTH:
/*
* Send authentication (user+password) when following locations, even when
* hostname changed.
*/
data->set.allow_auth_to_other_hosts =
(0 != va_arg(param, long)) ? TRUE : FALSE;
break;
case CURLOPT_MAXREDIRS:
/*
* The maximum amount of hops you allow curl to follow Location:
* headers. This should mostly be used to detect never-ending loops.
*/
arg = va_arg(param, long);
if(arg < -1)
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.maxredirs = arg;
break;
case CURLOPT_POSTREDIR:
/*
* Set the behaviour of POST when redirecting
* CURL_REDIR_GET_ALL - POST is changed to GET after 301 and 302
* CURL_REDIR_POST_301 - POST is kept as POST after 301
* CURL_REDIR_POST_302 - POST is kept as POST after 302
* CURL_REDIR_POST_303 - POST is kept as POST after 303
* CURL_REDIR_POST_ALL - POST is kept as POST after 301, 302 and 303
* other - POST is kept as POST after 301 and 302
*/
arg = va_arg(param, long);
if(arg < CURL_REDIR_GET_ALL)
/* no return error on too high numbers since the bitmask could be
extended in a future */
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.keep_post = arg & CURL_REDIR_POST_ALL;
break;
case CURLOPT_POST:
/* Does this option serve a purpose anymore? Yes it does, when
CURLOPT_POSTFIELDS isn't used and the POST data is read off the
callback! */
if(va_arg(param, long)) {
data->set.method = HTTPREQ_POST;
data->set.opt_no_body = FALSE; /* this is implied */
}
else
data->set.method = HTTPREQ_GET;
break;
/* MQTT "borrows" some of the HTTP options */
#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_MQTT)
case CURLOPT_COPYPOSTFIELDS:
/*
* A string with POST data. Makes curl HTTP POST. Even if it is NULL.
@ -622,6 +530,100 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.postfieldsize = bigsize;
break;
#endif
#ifndef CURL_DISABLE_HTTP
case CURLOPT_AUTOREFERER:
/*
* Switch on automatic referer that gets set if curl follows locations.
*/
data->set.http_auto_referer = (0 != va_arg(param, long)) ? TRUE : FALSE;
break;
case CURLOPT_ACCEPT_ENCODING:
/*
* String to use at the value of Accept-Encoding header.
*
* If the encoding is set to "" we use an Accept-Encoding header that
* encompasses all the encodings we support.
* If the encoding is set to NULL we don't send an Accept-Encoding header
* and ignore an received Content-Encoding header.
*
*/
argptr = va_arg(param, char *);
if(argptr && !*argptr) {
argptr = Curl_all_content_encodings();
if(!argptr)
result = CURLE_OUT_OF_MEMORY;
else {
result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
free(argptr);
}
}
else
result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
break;
case CURLOPT_TRANSFER_ENCODING:
data->set.http_transfer_encoding = (0 != va_arg(param, long)) ?
TRUE : FALSE;
break;
case CURLOPT_FOLLOWLOCATION:
/*
* Follow Location: header hints on a HTTP-server.
*/
data->set.http_follow_location = (0 != va_arg(param, long)) ? TRUE : FALSE;
break;
case CURLOPT_UNRESTRICTED_AUTH:
/*
* Send authentication (user+password) when following locations, even when
* hostname changed.
*/
data->set.allow_auth_to_other_hosts =
(0 != va_arg(param, long)) ? TRUE : FALSE;
break;
case CURLOPT_MAXREDIRS:
/*
* The maximum amount of hops you allow curl to follow Location:
* headers. This should mostly be used to detect never-ending loops.
*/
arg = va_arg(param, long);
if(arg < -1)
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.maxredirs = arg;
break;
case CURLOPT_POSTREDIR:
/*
* Set the behaviour of POST when redirecting
* CURL_REDIR_GET_ALL - POST is changed to GET after 301 and 302
* CURL_REDIR_POST_301 - POST is kept as POST after 301
* CURL_REDIR_POST_302 - POST is kept as POST after 302
* CURL_REDIR_POST_303 - POST is kept as POST after 303
* CURL_REDIR_POST_ALL - POST is kept as POST after 301, 302 and 303
* other - POST is kept as POST after 301 and 302
*/
arg = va_arg(param, long);
if(arg < CURL_REDIR_GET_ALL)
/* no return error on too high numbers since the bitmask could be
extended in a future */
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.keep_post = arg & CURL_REDIR_POST_ALL;
break;
case CURLOPT_POST:
/* Does this option serve a purpose anymore? Yes it does, when
CURLOPT_POSTFIELDS isn't used and the POST data is read off the
callback! */
if(va_arg(param, long)) {
data->set.method = HTTPREQ_POST;
data->set.opt_no_body = FALSE; /* this is implied */
}
else
data->set.method = HTTPREQ_GET;
break;
case CURLOPT_HTTPPOST:
/*

View File

@ -227,7 +227,7 @@ static const struct Curl_handler * const protocols[] = {
&Curl_handler_rtsp,
#endif
#ifdef CURL_ENABLE_MQTT
#ifndef CURL_DISABLE_MQTT
&Curl_handler_mqtt,
#endif

View File

@ -298,7 +298,7 @@ static const char * const protocols[] = {
"ldaps",
#endif
#endif
#ifdef CURL_ENABLE_MQTT
#ifndef CURL_DISABLE_MQTT
"mqtt",
#endif
#ifndef CURL_DISABLE_POP3