mqtt: extend the error message for no topic

... and mention that it needs URL encoding.

Reported-by: Peter Körner
Fixes #7316
Closes #7317
This commit is contained in:
Daniel Stenberg 2021-06-30 08:30:24 +02:00
parent e6caaa41b0
commit 5372ee37d3
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 5 additions and 13 deletions

View File

@ -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;