Authenticating for HTTP stream

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Cyntrox
New Cone
New Cone
Posts: 5
Joined: 28 Nov 2010 18:26

Authenticating for HTTP stream

Postby Cyntrox » 28 Nov 2010 23:45

Hey, I'm trying to listen to a HTTP stream requiring authentication - and I can't get VLC to sent the username and password. Here's what I'm trying:

Code: Select all

vlc http://stream.magnatune.com/artists/albums/mit-diplomat/ogg_nospeech.m3u --sout-http-user *username* --sout-http-pwd *password* --sout '#transcode{acodec=mpga}:std{mux=wav,access=http,dst=10.0.0.1:8000}'
Using packet tracking, however, reveals that there is no username and password being sent. Here is the packet sent with the above command:

Code: Select all

0x0000: 4500 008c 98ff 4000 4006 0c94 c19d fee5 E.....@.@....... 0x0010: 403e 9417 da0d 0050 616c a509 2416 5ebf @>.....Pal..$.^. 0x0020: 8018 005c 9557 0000 0101 080a 2a74 3f0c ...\.W......*t?. 0x0030: 02ba 8821 4745 5420 2f61 7274 6973 7473 ...!GET./artists 0x0040: 2f61 6c62 756d 732f 6d69 742d 6469 706c /albums/mit-dipl 0x0050: 6f6d 6174 2f6f 6767 5f6e 6f73 7065 6563 omat/ogg_nospeec 0x0060: 682e 6d33 7520 4854 5450 2f31 2e31 0d0a h.m3u.HTTP/1.1.. 0x0070: 486f 7374 3a20 7374 7265 616d 2e6d 6167 Host:.stream.mag 0x0080: 6e61 7475 6e65 2e63 6f6d 0d0a natune.com..
As you may or may not see, there is no HTTP authentication headers in that packet. Does anyone know why this happens?

General information: Using VLC 1.1.5 on a Slackware installation.

Rémi Denis-Courmont
Developer
Developer
Posts: 15326
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Authenticating for HTTP stream

Postby Rémi Denis-Courmont » 29 Nov 2010 16:49

You need to pass the username and password in the URL in this case. --sout-http- options are for Streaming OUTput only.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Cyntrox
New Cone
New Cone
Posts: 5
Joined: 28 Nov 2010 18:26

Re: Authenticating for HTTP stream

Postby Cyntrox » 29 Nov 2010 18:38

Thank you for the suggestion, however, unless I'm missing some way to encode the username and password in the URL, it doesn't work.

This:

Code: Select all

vlc http://user:pass@stream.magnatune.com/artists/albums/mit-diplomat/ogg_nospeech.m3u --sout '#transcode{acodec=mpga}:std{mux=wav,access=http,dst=10.0.0.1:8000}'
gives this:

Code: Select all

0x0000: 4500 0091 1eb8 4000 4006 86d6 c19d fee5 E.....@.@....... 0x0010: 403e 9417 b966 0050 57bb 87fd 1c41 9d81 @>...f.PW....A.. 0x0020: 8018 005c 955c 0000 0101 080a 2e66 9a52 ...\.\.......f.R 0x0030: 0322 2a4a 4745 5420 2f61 6c6c 2f30 312d ."*JGET./all/01- 0x0040: 696e 7472 6f2d 4d61 6368 696e 6573 2532 intro-Machines%2 0x0050: 3069 6e25 3230 5472 616e 7369 745f 6e6f 0in%20Transit_no 0x0060: 7370 6565 6368 2e6f 6767 2048 5454 502f speech.ogg.HTTP/ 0x0070: 312e 310d 0a48 6f73 743a 2073 7472 6561 1.1..Host:.strea 0x0080: 6d2e 6d61 676e 6174 756e 652e 636f 6d0d m.magnatune.com. 0x0090: 0a .

Rémi Denis-Courmont
Developer
Developer
Posts: 15326
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Authenticating for HTTP stream

Postby Rémi Denis-Courmont » 29 Nov 2010 22:31

Well, a .m3u URL is probably a playlist file, i.e. text. VLC cannot transcode text to MPEG Audio.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Cyntrox
New Cone
New Cone
Posts: 5
Joined: 28 Nov 2010 18:26

Re: Authenticating for HTTP stream

Postby Cyntrox » 30 Nov 2010 21:37

Actually, VLC is able to get and parse the playlist file - further research has, in fact, shown that VLC does send the username and password with the first request (the one getting the .m3u), but when it tries to get the tracks from the playlist, it doesn't authenticate itself.

Just to be clear, this is the error I'm getting in VLC:

Code: Select all

[0x80eabf4] access_mms access error: error: HTTP/1.1 401 Authorization Required [0x80f352c] main input error: open of `http://stream.magnatune.com/all/01-intro-Machines%20in%20Transit_nospeech.ogg' failed: (null) [0x80f352c] main input error: Your input can't be opened

zakak
New Cone
New Cone
Posts: 1
Joined: 09 Dec 2010 15:46

Re: Authenticating for HTTP stream

Postby zakak » 10 Dec 2010 18:21

As a workaround, I create a new .m3u file with the user/pass in each URL:

Code: Select all

#!/bin/bash user=foo pass=bar #url=http://stream.magnatune.com/artists/albums/mit-diplomat/ogg_nospeech.m3u url=$1 function to_auth { while read line;do echo "$line" | sed "s/http:\/\//http:\/\/$user:$pass@/g" done } wget -qO- $(echo "$url" | to_auth) | to_auth


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 57 guests