Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic auth feature and SSL feature. #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

harajune
Copy link

@harajune harajune commented Jul 18, 2021

Issues

  • AudioFileSourceHTTPStream lacks a basic auth feature.
  • Also, SSL.

What I created

  • add setAuthorization method to AudioFileSourceHTTPStream. This method will set the basic auth setting to HTTPClient.
  • add setClient method to AudioFileSourceHTTPStream. This method enables users to use WiFiClientSecure to set a root CA certificate.

Sample

wifi_client = new WiFiClientSecure();
wifi_client->setCACert(ROOT_CA);

file = new AudioFileSourceHTTPStream();
file->setClient(wifi_client); // here
file->setAuthorization(BASIC_USER, BASIC_PASS); // here
file->open(url);
buff = new AudioFileSourceBuffer(file, 2048);
out = new AudioOutputI2S(0, 1);
out->SetOutputModeMono(true);
out->SetGain(1.0);
mp3 = new AudioGeneratorMP3();
mp3->RegisterStatusCB(StatusCallback, (void*)"mp3");
mp3->begin(buff, out);

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing related to URL size change, but generally looks good. Thanks!

src/AudioFileSourceHTTPStream.h Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants