-
-
Notifications
You must be signed in to change notification settings - Fork 309
VS1053 streaming returns a 401 error for a url that works fine in Chrome #2093
-
Encountered this 401 problem with a url that works fine in my chrome browser.
I start url.begin("http://vprclassical.streamguys.net:80/vprclassical128.mp3"); with no luck.
I used chrome to check what headers chrome sends, as I thougt that might give some clue why chrome has succes, and url.begin is less fortunate.
I added/modifies the headers that are now send with url.begin(), even in the same order as chrome does.
But still no luck.
Here` are the headers that Chrome sends along:
GET /vprclassical128.mp3 HTTP/1.1
Accept: */*
Accept-Encoding: identity;q=1, *;q=0
Accept-Language: nl,en-US;q=0.9,en;q=0.8,nl-NL;q=0.7,en-NL;q=0.6
Connection: keep-alive
Host: vprclassical.streamguys.net
Range: bytes=0-
Referer: http://vprclassical.streamguys.net/vprclassical128.mp3
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
And this is the output on my serial port:
20:17:38.439 -> url.begin ->http://vprclassical.streamguys.net:80/vprclassical128.mp3
20:17:38.439 -> [I] URLStream.h : 90 - virtual bool audio_tools::URLStream::begin(const char*, const char*, MethodID, const char*, const char*): http://vprclassical.streamguys.net:80/vprclassical128.mp3
20:17:38.439 -> [I] Url.h : 58 - Url::parse
20:17:38.439 -> [I] Url.h : 96 - url->http://vprclassical.streamguys.net:80/vprclassical128.mp3
20:17:38.483 -> [I] Url.h : 97 - host->vprclassical.streamguys.net
20:17:38.483 -> [I] Url.h : 98 - protocol->http
20:17:38.483 -> [I] Url.h : 99 - path->/vprclassical128.mp3
20:17:38.483 -> [I] Url.h : 100 - port->80
20:17:38.483 -> [I] URLStream.h : 385 - WiFiClient
20:17:38.483 -> [I] HttpRequest.h : 255 - process connecting to host vprclassical.streamguys.net port 80
20:17:38.593 -> [I] HttpRequest.h : 389 - is connected true with timeout 5000
20:17:38.593 -> [I] HttpRequest.h : 266 - Free heap: 185236
20:17:38.625 -> [I] HttpHeader.h : 267 - HttpHeader::write
20:17:38.625 -> [I] HttpHeader.h : 422 - -> GET /vprclassical128.mp3 HTTP/1.1
20:17:38.625 -> [I] HttpHeader.h : 201 - -> Accept: */*
20:17:38.625 -> [I] HttpHeader.h : 201 - -> Accept-Encoding: identity;q=1, *;q=0
20:17:38.625 -> [I] HttpHeader.h : 201 - -> Accept-Language: nl,en-US;q=0.9,en;q=0.8,nl-NL;q=0.7,en-NL;q=0.6
20:17:38.657 -> [I] HttpHeader.h : 201 - -> Connection: keep-alive
20:17:38.657 -> [I] HttpHeader.h : 201 - -> Host: vprclassical.streamguys.net
20:17:38.657 -> [I] HttpHeader.h : 201 - -> Range: bytes=0-
20:17:38.657 -> [I] HttpHeader.h : 201 - -> Referer: http://vprclassical.streamguys.net/vprclassical128.mp3
20:17:38.657 -> [I] HttpHeader.h : 201 - -> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
20:17:38.701 -> [I] HttpHeader.h : 343 - -> <CR LF>
20:17:38.701 -> [I] HttpRequest.h : 334 - Request written ... waiting for reply
20:17:38.779 -> [I] HttpHeader.h : 235 - Waiting for data...
20:17:43.692 -> [E] HttpHeader.h : 239 - Request timed out after 5000 ms
20:17:43.692 -> [I] HttpRequest.h : 196 - no CONTENT_LENGTH found in reply
20:17:43.692 -> [I] URLStream.h : 98 - contentLength: 0
20:17:43.730 -> [I] URLStream.h : 241 - Request written ... waiting for reply
20:17:43.730 -> [E] URLStream.h : 246 - Error code recieved ... stop waiting for reply
20:17:43.730 -> [I] URLStream.h : 105 - ==> http status: 401
So I am sending the exact same headers, as it seems to me, but stll that 401 error. Needless to say that many other urls just work fine, but for some reason, this one doesn't.
Any ideas what else I can explore? I ran out of ideas...
Thanks in advance,
Frank
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
Hi @Frank-Bemelman. Could you share the code?
Beta Was this translation helpful? Give feedback.
All reactions
-
Hello @wprudencio, it's basically just this:
return_result = url.begin("http://vprclassical.streamguys.net/vprclassical128.mp3","audio/mp3");
Nothing special. Many other links work just fine.
I switched to another library now, (https://github.com/CelliesProjects/ESP32_VS1053_Stream) which works with this url and generally accepts a lot more urls I had problems with.
So, to be blunt and honest, the problem is out of the way...
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1