espressif / esp-adf

Espressif Audio Development Framework
Other
1.5k stars 670 forks source link

http_stream: support HTTP authentication (AUD-4994) #1103

Open stintel opened 8 months ago

stintel commented 8 months ago

To support authentication in Willow Inference Server to allow people to run public, shared WIS servers, we need HTTP authentication support in http_stream. This PR adds support for it.

jason-mao commented 8 months ago

@stintel Thank you for your contributions. It will be merged.

shootao commented 8 months ago

Hi @stintel Could you help provide a complete PR submission, as shown in the attachment, considering the memory situation 0001-http_stream-add-http-client-configure.patch

stintel commented 8 months ago

After submitting this PR, I discovered I could just use esp_http_client_set_authtype() and in the HTTP_STREAM_PRE_REQUEST event of the http_stream event_handle. Username and password is then automatically set by http_parser if included in the URL. This is slightly less efficient, as it has to be done on every new stream, while with this PR it would have to be set once, if I understand correctly, but I'm not sure if that's worth all the additional code. If you still think this change is valuable, let me know, and I'll make the requested changes.