Gealber Morales via curl-library
2021-05-21 21:46:40 UTC
Hello there, I've been trying to add support for the use of username in the
implementation of MQTT in libcurl. I think I finally succeed, anyone that
can give me his/her opinion is welcome. To test the correctness of this
addition I made the following:
1. Ran a container of emqx/emqx listening on port 1883
2. Opened Wireshark to be able to inspect the packets sent by curl with my
modifications
3. Made the request with cURL as follows:
./curl -d 94 --user lola:passwd -v mqtt://localhost:1883/curl/mqtt
Some details here with this request:
- The -d option, is the data to be published
- In the option --user is required to be passed the password as well, but
I'm not actually making use of it.
- The last path is the topic to which the publisher want to publish data,
in our case /curl/mqtt.
In order to improve this, it would be nice to at least not be required the
password to be supplied. Looking at the command line options, I don't found
a way
to supply just the user. In case you know, write me back, and I'll use that
option instead, because this one is more appropriate for supporting
user-password.
After making the request with the modifications, all seems to go ok,
inspecting the packets in Wireshark also seems to be good. Here's a gist
with the part of the code been added and a simple modification in the
mqtt_connect
function.
mqtt.c modified, snippet
<https://gist.github.com/Gealber/f679d47e7315fd7171557b6848427f33>
<https://gist.github.com/Gealber/f679d47e7315fd7171557b6848427f33>
Let me know on any thoughts of how to improve this.
Greetings, Gealber
implementation of MQTT in libcurl. I think I finally succeed, anyone that
can give me his/her opinion is welcome. To test the correctness of this
addition I made the following:
1. Ran a container of emqx/emqx listening on port 1883
2. Opened Wireshark to be able to inspect the packets sent by curl with my
modifications
3. Made the request with cURL as follows:
./curl -d 94 --user lola:passwd -v mqtt://localhost:1883/curl/mqtt
Some details here with this request:
- The -d option, is the data to be published
- In the option --user is required to be passed the password as well, but
I'm not actually making use of it.
- The last path is the topic to which the publisher want to publish data,
in our case /curl/mqtt.
In order to improve this, it would be nice to at least not be required the
password to be supplied. Looking at the command line options, I don't found
a way
to supply just the user. In case you know, write me back, and I'll use that
option instead, because this one is more appropriate for supporting
user-password.
After making the request with the modifications, all seems to go ok,
inspecting the packets in Wireshark also seems to be good. Here's a gist
with the part of the code been added and a simple modification in the
mqtt_connect
function.
mqtt.c modified, snippet
<https://gist.github.com/Gealber/f679d47e7315fd7171557b6848427f33>
<https://gist.github.com/Gealber/f679d47e7315fd7171557b6848427f33>
Let me know on any thoughts of how to improve this.
Greetings, Gealber