Issue with AudioPlayer when using a mix of http and https urls #1446
-
Dear Phil, First a big thank you for this spectacular masterpiece of software... impressive ! I think I found a minor issue but not being sure if I misunderstood things, I first post it here in the discussions. I modified slightly one of the examples (player-url-i2s) using a mixture of https and http urls. I think I found a feature in URLStream.h which prevents using a mixture of secure and insecure urls (http and https): Line 355: f (client != nullptr) return *client; If the client variable has previously been set in the Object, it will be reused. But this means, if you switch from http to https you will always use the same client (the one which was created the first time an URL was used in the object). Hence, when you started with an http url an "insecure" client is used to handle a https request later. This times out and does not work. If you put the https URL as the first URL in the list, it is presented as first url to the URLStream object and it works. However, if you then want to play a http url it fails since the "WIFIClintSecure" cannot handle insecure urls. I solved this by brute force commenting out the line mentioned above. I think this does not do any damage since at maximum one WiFiClient and one WiFiCLientSecure will be constructed and then we are good for all urls. I also checked that if the url is changed (in URLStream.preProcess(...) afterwards the getClient(...) method is called. Not sure if I missed anything... I do not have a good overview of this software yet and in addition I do not work with the Arduino ecosystem (so far I used the bare bone idf system of Espressif). The problem can be re-produced with the modifed example below (just changed the url list and some pins for my setup). I hope this message is useful and I did not oversee something ... Thanks again for this super library! Chris I use the following enviroment: PlatformIO with arduino framework. This is my plaformio.ini:
audio-tools library 0.9.6 And here my slightly modified example code:
The modified "getClient" routine in URLStream (Just inserted commented out the first if-statement)
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You are right: I did not expect to process mixed http and https requests since I had mainly this usage example in mind. |
Beta Was this translation helpful? Give feedback.
-
Great! |
Beta Was this translation helpful? Give feedback.
You are right: I did not expect to process mixed http and https requests since I had mainly this usage example in mind.
I committed a correction which keeps the different client implementations better apart.