Closed powertomato closed 4 months ago
All the current usage of this library specifies a protocol (AMQP/MQTT). Usage without a protocol is currently not supported or tested.
Closing this issue since this library is specific for being used by azure-iot-sdk-c. Direct use is not supported nor maintained. Thanks, Azure IoT SDKs Team
The issue occurs in
on_underlying_io_open_complete
after auws_client_create
and subsequentuws_client_open_async
call. Here is the snippet I'm using:When I specify the parameter protocols to NULL, on the server I still receive the "Sec-WebSocket-Protocol" entry with the value "Protocol: %s". As I understand it, if
protocol == NULL
andcount==0
, the header entry should be omitted. Further the value received at the server looks suspiciously like an access violation.Looking at the code, I think this is indeed the case:
In the following line the protocols array is set to NULL: https://github.com/Azure/azure-c-shared-utility/blob/718ec00a1df4917f1ee8aa528bdfa37e56bd8e92/src/uws_client.c#L291
and later, as a connection is opened, there are no NULL checks, but still the
protocols[0]
value is used: https://github.com/Azure/azure-c-shared-utility/blob/718ec00a1df4917f1ee8aa528bdfa37e56bd8e92/src/uws_client.c#L825 https://github.com/Azure/azure-c-shared-utility/blob/718ec00a1df4917f1ee8aa528bdfa37e56bd8e92/src/uws_client.c#L849There are couple of other places not relevant for "Sec-WebSocket-Protocol", but probably still require a fix.