diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-06-30 08:30:24 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-06-30 15:02:24 +0200 |
commit | 5372ee37d394b27f86ada8d9c50fc9b094c27675 (patch) | |
tree | e1b204109970c559ef59dc324d1074eb2165c4a6 /lib/mqtt.c | |
parent | e6caaa41b0d2ee28fd9f8bc226b650bb529cb320 (diff) | |
download | curl-5372ee37d394b27f86ada8d9c50fc9b094c27675.tar.gz |
mqtt: extend the error message for no topic
... and mention that it needs URL encoding.
Reported-by: Peter Körner
Fixes #7316
Closes #7317
Diffstat (limited to 'lib/mqtt.c')
-rw-r--r-- | lib/mqtt.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/mqtt.c b/lib/mqtt.c index 9a3ca222f..81bf37864 100644 --- a/lib/mqtt.c +++ b/lib/mqtt.c @@ -378,22 +378,14 @@ fail: static CURLcode mqtt_get_topic(struct Curl_easy *data, char **topic, size_t *topiclen) { - CURLcode result = CURLE_OK; char *path = data->state.up.path; - - if(strlen(path) > 1) { - result = Curl_urldecode(data, path + 1, 0, topic, topiclen, - REJECT_NADA); - } - else { - failf(data, "Error: No topic specified."); - result = CURLE_URL_MALFORMAT; - } - return result; + if(strlen(path) > 1) + return Curl_urldecode(data, path + 1, 0, topic, topiclen, + REJECT_NADA); + failf(data, "No MQTT topic found. Forgot to URL encode it?"); + return CURLE_URL_MALFORMAT; } - - static CURLcode mqtt_subscribe(struct Curl_easy *data) { CURLcode result = CURLE_OK; |