User-agent in http header
Posted: 03 Jun 2013 15:55
Hi,
I am trying to change HTTP header, particularly user-agent from default to something else, since the server redirect to unknown adress if VLC player is detected. I wrote the following script, but it does not work in my case, so please help, I dont know where the problem is.
I tried to capture package and read the headers using Wireshark, the header is modified, but all options are actually removed
[/quote]
ps. You can test it by entering the stream
I am trying to change HTTP header, particularly user-agent from default to something else, since the server redirect to unknown adress if VLC player is detected. I wrote the following script, but it does not work in my case, so please help, I dont know where the problem is.
Code: Select all
-- Probe function.
function probe()
return vlc.access == "http"
and string.match( "test", "test" ) -- return true for every http stream
-- and string.match( vlc.path, "http://best.str.nettvplus.com:8080/stream/?channel=pinksi3sbb&stream=1mb&sp=nettvplus&b=10?u=WWWP4FFG&p=I2ZQV7X8" )
-- do not match other addresses,
-- else we'll also try to decode the actual video url
end
-- Parse function.
function parse()
agent = vlc.var.inherit(nil,"http-user-agent")
-- if string.match( string.lower(agent), ".*vlc.*" ) then
-- vlc.msg.dbg("Wrong agent, adapting...")
return { { path = vlc.access .. "://" .. vlc.path; options = {":http-user-agent=Mozilla/5.0" } } }
end
[/quote]
ps. You can test it by entering the stream