mirror of
https://github.com/moparisthebest/curl
synced 2024-11-15 22:15:13 -05:00
mqtt: enable by default
No longer considered experimental. Closes #5858
This commit is contained in:
parent
ede125b7b7
commit
e37e446868
@ -80,8 +80,6 @@ jobs:
|
|||||||
- env:
|
- env:
|
||||||
- T=normal C="--enable-ares"
|
- T=normal C="--enable-ares"
|
||||||
- OVERRIDE_CC="CC=gcc-8" OVERRIDE_CXX="CXX=g++-8"
|
- OVERRIDE_CC="CC=gcc-8" OVERRIDE_CXX="CXX=g++-8"
|
||||||
- env:
|
|
||||||
- T=normal C="--enable-mqtt"
|
|
||||||
- env:
|
- env:
|
||||||
- T=normal C="--disable-proxy"
|
- T=normal C="--disable-proxy"
|
||||||
- env:
|
- env:
|
||||||
|
@ -190,8 +190,8 @@ option(CURL_DISABLE_SMTP "to disable SMTP" OFF)
|
|||||||
mark_as_advanced(CURL_DISABLE_SMTP)
|
mark_as_advanced(CURL_DISABLE_SMTP)
|
||||||
option(CURL_DISABLE_GOPHER "to disable Gopher" OFF)
|
option(CURL_DISABLE_GOPHER "to disable Gopher" OFF)
|
||||||
mark_as_advanced(CURL_DISABLE_GOPHER)
|
mark_as_advanced(CURL_DISABLE_GOPHER)
|
||||||
option(CURL_ENABLE_MQTT "to enable MQTT" OFF)
|
option(CURL_DISABLE_MQTT "to disable MQTT" OFF)
|
||||||
mark_as_advanced(CURL_ENABLE_MQTT)
|
mark_as_advanced(CURL_DISABLE_MQTT)
|
||||||
|
|
||||||
if(HTTP_ONLY)
|
if(HTTP_ONLY)
|
||||||
set(CURL_DISABLE_FTP ON)
|
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("SFTP" USE_LIBSSH2 OR USE_LIBSSH)
|
||||||
_add_if("RTSP" NOT CURL_DISABLE_RTSP)
|
_add_if("RTSP" NOT CURL_DISABLE_RTSP)
|
||||||
_add_if("RTMP" USE_LIBRTMP)
|
_add_if("RTMP" USE_LIBRTMP)
|
||||||
_add_if("MQTT" CURL_ENABLE_MQTT)
|
_add_if("MQTT" NOT CURL_DISABLE_MQTT)
|
||||||
if(_items)
|
if(_items)
|
||||||
list(SORT _items)
|
list(SORT _items)
|
||||||
endif()
|
endif()
|
||||||
|
@ -645,11 +645,10 @@ AC_HELP_STRING([--disable-mqtt],[Disable MQTT support]),
|
|||||||
[ case "$enableval" in
|
[ case "$enableval" in
|
||||||
no)
|
no)
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
|
AC_DEFINE(CURL_DISABLE_MQTT, 1, [to disable MQTT])
|
||||||
|
AC_SUBST(CURL_DISABLE_MQTT, [1])
|
||||||
;;
|
;;
|
||||||
*) AC_MSG_RESULT(yes)
|
*) AC_MSG_RESULT(yes)
|
||||||
experimental="$experimental MQTT"
|
|
||||||
AC_DEFINE(CURL_ENABLE_MQTT, 1, [to enable MQTT])
|
|
||||||
AC_SUBST(CURL_ENABLE_MQTT, [1])
|
|
||||||
;;
|
;;
|
||||||
esac ],
|
esac ],
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
@ -5082,7 +5081,7 @@ fi
|
|||||||
if test "x$CURL_DISABLE_GOPHER" != "x1"; then
|
if test "x$CURL_DISABLE_GOPHER" != "x1"; then
|
||||||
SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
|
SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
|
||||||
fi
|
fi
|
||||||
if test "x$CURL_ENABLE_MQTT" = "x1"; then
|
if test "x$CURL_DISABLE_MQTT" != "x1"; then
|
||||||
SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS MQTT"
|
SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS MQTT"
|
||||||
fi
|
fi
|
||||||
if test "x$CURL_DISABLE_POP3" != "x1"; then
|
if test "x$CURL_DISABLE_POP3" != "x1"; then
|
||||||
|
@ -62,6 +62,10 @@ Disable the --libcurl option from the curl tool.
|
|||||||
|
|
||||||
Disable MIME support.
|
Disable MIME support.
|
||||||
|
|
||||||
|
## CURL_DISABLE_MQTT
|
||||||
|
|
||||||
|
Disable MQTT support.
|
||||||
|
|
||||||
## CURL_DISABLE_NETRC
|
## CURL_DISABLE_NETRC
|
||||||
|
|
||||||
Disable the netrc parser.
|
Disable the netrc parser.
|
||||||
|
@ -20,5 +20,4 @@ Experimental support in curl means:
|
|||||||
|
|
||||||
- HTTP/3 support and options
|
- HTTP/3 support and options
|
||||||
- alt-svc support and options
|
- alt-svc support and options
|
||||||
- MQTT
|
|
||||||
- CURLSSLOPT_NATIVE_CA (No configure option, feature built in when supported)
|
- CURLSSLOPT_NATIVE_CA (No configure option, feature built in when supported)
|
||||||
|
@ -63,8 +63,8 @@
|
|||||||
/* to disable LDAPS */
|
/* to disable LDAPS */
|
||||||
#cmakedefine CURL_DISABLE_LDAPS 1
|
#cmakedefine CURL_DISABLE_LDAPS 1
|
||||||
|
|
||||||
/* to enable MQTT */
|
/* to disable MQTT */
|
||||||
#undef CURL_ENABLE_MQTT
|
#cmakedefine CURL_DISABLE_MQTT 1
|
||||||
|
|
||||||
/* to disable POP3 */
|
/* to disable POP3 */
|
||||||
#cmakedefine CURL_DISABLE_POP3 1
|
#cmakedefine CURL_DISABLE_POP3 1
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "curl_setup.h"
|
#include "curl_setup.h"
|
||||||
|
|
||||||
#ifdef CURL_ENABLE_MQTT
|
#ifndef CURL_DISABLE_MQTT
|
||||||
|
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
@ -625,4 +625,4 @@ static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CURL_ENABLE_MQTT */
|
#endif /* CURL_DISABLE_MQTT */
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifdef CURL_ENABLE_MQTT
|
#ifndef CURL_DISABLE_MQTT
|
||||||
extern const struct Curl_handler Curl_handler_mqtt;
|
extern const struct Curl_handler Curl_handler_mqtt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
190
lib/setopt.c
190
lib/setopt.c
@ -434,100 +434,8 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef CURL_DISABLE_HTTP
|
/* MQTT "borrows" some of the HTTP options */
|
||||||
case CURLOPT_AUTOREFERER:
|
#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_MQTT)
|
||||||
/*
|
|
||||||
* 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_COPYPOSTFIELDS:
|
case CURLOPT_COPYPOSTFIELDS:
|
||||||
/*
|
/*
|
||||||
* A string with POST data. Makes curl HTTP POST. Even if it is NULL.
|
* 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;
|
data->set.postfieldsize = bigsize;
|
||||||
break;
|
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:
|
case CURLOPT_HTTPPOST:
|
||||||
/*
|
/*
|
||||||
|
@ -227,7 +227,7 @@ static const struct Curl_handler * const protocols[] = {
|
|||||||
&Curl_handler_rtsp,
|
&Curl_handler_rtsp,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CURL_ENABLE_MQTT
|
#ifndef CURL_DISABLE_MQTT
|
||||||
&Curl_handler_mqtt,
|
&Curl_handler_mqtt,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ static const char * const protocols[] = {
|
|||||||
"ldaps",
|
"ldaps",
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef CURL_ENABLE_MQTT
|
#ifndef CURL_DISABLE_MQTT
|
||||||
"mqtt",
|
"mqtt",
|
||||||
#endif
|
#endif
|
||||||
#ifndef CURL_DISABLE_POP3
|
#ifndef CURL_DISABLE_POP3
|
||||||
|
Loading…
Reference in New Issue
Block a user