Azure / azure-c-shared-utility

Azure C SDKs common code
Other
111 stars 203 forks source link

Proxy use-case fixed for wolfSSL #504

Closed momuno closed 3 years ago

momuno commented 3 years ago

This fixes the issue reported in https://github.com/Azure/azure-iot-sdk-c/issues/1842

I have tested this with and without a proxy, for all 4 working protocols. MQTT, MQTT/WS, AMQP, AMQP/WS. HTTP is not working currently and already has an issue filed for it.

momuno commented 3 years ago

It also looks like the Proxy state is HTTP_PROXY_IO_STATE_WAITING_FOR_CONNECT_RESPONSE when tlsio_wolfSSL_dowork is first called. When decode_ssl_received_bytes is then called, wolfSSL will end up internally calling wolfSSL_connect -> ... -> on_io_send -> xio_send -> http_proxy_io_send, but since the Proxy state is not yet HTTP_PROXY_IO_STATE_OPEN, the failure occurs on line 850 of http_proxy_io.c

The proxy state is updated to HTTP_PROXY_IO_STATE_OPEN in (http_proxy_io.c)on_underlying_io_bytes_received