Customize http request headers

Discuss your Lua playlist, album art and interface scripts.
freetz
New Cone
New Cone
Posts: 1
Joined: 06 Jul 2017 08:32

Customize http request headers

Postby freetz » 06 Jul 2017 08:51

Hello everyone,

I'm not sure if this is the right forum to ask this, but I have a problem streaming video files which are stored on my Huawei E5372 mobile WiFi router's micro SD card.
The router provides web-based access to the files on the SD card only, but when pasting the links into VLC, the files are not played. The reason seems to be that VLC sends a "Range bytes=0-" header, where the "0-" is problematic. When a fixed range is provided (such as 50-100), the request is served correctly by the Huawei.
So my question is whether there is a way to retreive a file from an URL like "http://192.168.8.1/sdcard/23_,mp4" and adjust the headers in such a way that the Range header is either omitted or comes with a fixed range? Or whether you could think of any other idea how to solve this issue?

Following are the headers and response of an unsuccessful VLC request and a successful request from Firefox. At the end is a -vvv verbose log when trying to play said file in VLC.

I'm really grateful for any kind of help!

F.

Unsuccessful VLC request:

Code: Select all

GET /sdcard/23_.mp4 HTTP/1.1 Host: 192.168.8.1 User-Agent: VLC/2.2.1 LibVLC/2.2.1 Range: bytes=0- Connection: close Icy-MetaData: 1
(Negative) reply from Huawei router to above request:

Code: Select all

HTTP/1.1 206 Partial Content Date: Thu, 01 Jan 1970 00:00:00 GMT Server: mini_httpd/1.19 19dec2003 Connection: close Content-Length: 1 Content-Type: application/download Content-Disposition:attachment; Connection: close Accept-Ranges: bytes 0-0 Content-Range: (null)/154796882 0
Successful request from Firefox:

Code: Select all

GET /sdcard/23_.mp4 HTTP/1.1 Host: 192.168.8.1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de,en-US;q=0.7,en;q=0.3 Accept-Encoding: gzip, deflate Referer: http://192.168.8.1/html/sdcardsharing.html DNT: 1 Connection: keep-alive
(Positive) reply from Huawei router to above request:

Code: Select all

HTTP/1.1 200 OK Date: Thu, 01 Jan 1970 00:00:00 GMT Server: mini_httpd/1.19 19dec2003 Connection: keep-alive Keep-Alive: timeout=10, max=100 Content-Length: 154796882 Content-Type: application/download Content-Disposition:attachment; Connection: close Accept-Ranges: bytes CONTENT-LANGUAGE: de,en-US;q=0.7,en;q=0.3
-vvv verbose debug log of VLC when opening said file directly from VLC:

Code: Select all

[000000010024b768] core playlist debug: using item 55 [000000010024b768] core playlist debug: starting playback of the new playlist item [000000010024b768] core playlist debug: resyncing on http://192.168.8.1/sdcard/23_.mp4 [000000010024b768] core playlist debug: http://192.168.8.1/sdcard/23_.mp4 is at 55 [000000010024b768] core playlist debug: creating new input thread [000000010f966d88] core input debug: Creating an input for 'http://192.168.8.1/sdcard/23_.mp4' [000000010024b768] core playlist debug: requesting art for http://192.168.8.1/sdcard/23_.mp4 [000000010f966d88] core input debug: using timeshift granularity of 50 MiB, in path '/tmp' [000000010f966d88] core input debug: `http://192.168.8.1/sdcard/23_.mp4' gives access `http' demux `' path `192.168.8.1/sdcard/23_.mp4' [000000010f966d88] core input debug: specified demux `any' [000000010f966d88] core input debug: creating demux: access='http' demux='any' location='192.168.8.1/sdcard/23_.mp4' file='(null)' [000000010f990f28] core art finder debug: looking for meta fetcher module matching "any": 1 candidates [0000000108defe68] core demux debug: looking for access_demux module matching "http": 14 candidates [000000010f990f28] lua art finder debug: Trying Lua scripts in /Users/frederik/Library/Application Support/org.videolan.vlc/lua/meta/fetcher [0000000108defe68] core demux debug: no access_demux modules matched [000000010f990f28] lua art finder debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/fetcher [000000010f966d88] core input debug: creating access 'http' location='192.168.8.1/sdcard/23_.mp4', path='(null)' [00000001003c2428] core access debug: looking for access module matching "http": 19 candidates [00000001003c2428] http access debug: querying proxy for http://192.168.8.1/sdcard/23_.mp4 [000000010f990f28] lua art finder debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/fetcher/tvrage.luac [00000001003c2428] http access debug: no proxy [00000001003c2428] http access debug: http: server='192.168.8.1' port=80 file='/sdcard/23_.mp4' [00000001003c2428] core access debug: net: connecting to 192.168.8.1 port 80 [000000010f990f28] lua art finder debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/fetcher/tvrage.luac [000000010f990f28] lua art finder debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/fetcher [000000010f990f28] core art finder debug: no meta fetcher modules matched [0000000100414568] core libvlc debug: searching art for http://192.168.8.1/sdcard/23_.mp4 [000000010f990e78] core art finder debug: looking for art finder module matching "any": 2 candidates [000000010f990e78] lua art finder debug: Trying Lua scripts in /Users/frederik/Library/Application Support/org.videolan.vlc/lua/meta/art [000000010f990e78] lua art finder debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/art [000000010f990e78] lua art finder debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/00_musicbrainz.luac [000000010f990e78] lua art finder debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/00_musicbrainz.luac [000000010f990e78] lua art finder debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/01_googleimage.luac [000000010f990e78] lua art finder debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/01_googleimage.luac [000000010f990e78] lua art finder debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/02_frenchtv.luac [00000001003c2428] core access debug: connection succeeded (socket = 7) [000000010f990e78] lua art finder debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/02_frenchtv.luac [000000010f990e78] lua art finder debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/03_lastfm.luac [0000000100253f68] macosx interface debug: releasing sleep blocker (37006) [000000010f990e78] lua art finder debug: skipping script (unmatched scope) /Applications/VLC.app/Contents/MacOS/share/lua/meta/art/03_lastfm.luac [000000010f990e78] lua art finder debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/meta/art [000000010f990e78] core art finder debug: no art finder modules matched [0000000100414568] core libvlc debug: art not found for http://192.168.8.1/sdcard/23_.mp4 [0000000100460a08] macosx audio output warning: variable stereo-mode doesn't exist or isn't handled [00000001003c2428] http access debug: protocol 'HTTP' answer code 206 [00000001003c2428] http access debug: Server: mini_httpd/1.19 19dec2003 [00000001003c2428] http access debug: Connection: close [00000001003c2428] http access debug: this frame size=1 [00000001003c2428] http access debug: Content-Type: video/mpeg4 [00000001003c2428] core access debug: using access module "http" [000000010fa6e448] core stream debug: Using stream method for AStream* [000000010fa6e448] core stream debug: starting pre-buffering [000000010fa6e448] core stream debug: received first data after 0 ms [0000000108defe68] core stream debug: looking for stream_filter module matching "any": 9 candidates [0000000108defe68] core stream debug: no stream_filter modules matched [0000000108defe68] core stream debug: looking for stream_filter module matching "record": 9 candidates [0000000108defe68] core stream debug: using stream_filter module "record" [000000010f966d88] core input debug: creating demux: access='http' demux='any' location='192.168.8.1/sdcard/23_.mp4' file='(null)' [000000010fa1f498] core demux debug: looking for demux module matching "any": 66 candidates [000000010fa1f498] es demux error: cannot peek [000000010fa1f498] es demux error: cannot peek [000000010fa1f498] es demux error: cannot peek [000000010fa1f498] es demux error: cannot peek [000000010fa1f498] es demux error: cannot peek [000000010fa1f498] pls demux debug: not enough data [000000010fa1f498] asx demux debug: not enough data [000000010fa1f498] mod demux debug: MOD validation failed (ext=) [000000010fa1f498] ps demux error: cannot peek [000000010fa1f498] mpgv demux error: cannot peek [000000010fa1f498] mjpeg demux error: data shortage [000000010fa1f498] lua demux debug: Trying Lua scripts in /Users/frederik/Library/Application Support/org.videolan.vlc/lua/playlist [000000010fa1f498] lua demux debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/playlist [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_streams.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/anevia_xml.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/appletrailers.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/bbc_co_uk.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/break.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/canalplus.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/cue.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/dailymotion.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/extreme.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/france2.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/googlevideo.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/jamendo.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/joox.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/katsomo.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/koreus.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/lelombrik.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/liveleak.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metacafe.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/metachannels.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/mpora.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pinkbike.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/pluzz.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/rockbox_fm_presets.luac [0000000100253f68] macosx interface debug: releasing sleep blocker (37006) [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/soundcloud.luac [0000000100460a08] macosx audio output warning: variable stereo-mode doesn't exist or isn't handled [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/vimeo.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/youtube_homepage.luac [000000010fa1f498] lua demux debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/playlist/zapiks.luac [000000010fa1f498] lua demux debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/share/lua/playlist [000000010fa1f498] avcodec demux debug: trying url: http://192.168.8.1/sdcard/23_.mp4 [000000010fa1f498] avcodec demux debug: CPU flags: 0x0107d3db [000000010fa1f498] avcodec demux debug: detected format: mov,mp4,m4a,3gp,3g2,mj2 [000000010fa1f498] avcodec demux error: Could not open http://192.168.8.1/sdcard/23_.mp4: Unbekannter Fehler [000000010fa1f498] ps demux error: cannot peek [000000010fa1f498] vobsub demux debug: could not read vobsub IDX file [000000010fa1f498] core demux debug: no demux modules matched [000000010f966d88] core input error: no suitable demux module for `http/any://192.168.8.1/sdcard/23_.mp4' [0000000108defe68] core stream debug: removing module "record" [00000001003c2428] core access debug: removing module "http" [000000010024b768] core playlist debug: finished input [000000010024b768] core playlist debug: dead input [000000010024b768] core playlist debug: changing item without a request (current 55/56) [000000010024b768] core playlist debug: nothing to play [0000000100253f68] macosx interface debug: releasing sleep blocker (37006) [0000000100253f68] macosx interface debug: Run loop has been stopped [0000000100253f68] macosx interface debug: Terminating [0000000100414568] core libvlc debug: VLC media player - 2.2.1 Terry Pratchett (Weatherwax) [0000000100414568] core libvlc debug: Copyright © 1996-2015 the VideoLAN team [0000000100414568] core libvlc debug: revision 2.2.1-0-ga425c42 [0000000100414568] core libvlc debug: configured with ../extras/package/macosx/../../../configure '--prefix=/Users/fpk/Desktop/vlc-2.2/secondrelease/vlc_install_dir' '--enable-macosx' '--enable-merge-ffmpeg' '--enable-growl' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-shout' '--enable-ncurses' '--enable-twolame' '--enable-realrtsp' '--enable-libass' '--enable-macosx-eyetv' '--enable-macosx-qtkit' '--enable-macosx-avfoundation' '--disable-skins2' '--disable-xcb' '--disable-caca' '--disable-sdl' '--disable-samplerate' '--disable-macosx-dialog-provider' '--with-macosx-version-min=10.6' '--build=x86_64-apple-darwin10' 'build_alias=x86_64-apple-darwin10' 'CC=xcrun clang' 'CFLAGS=' 'LDFLAGS=' 'CXX=xcrun clang++' 'OBJC=xcrun clang' [0000000100253f68] macosx interface debug: Killing extension dialog provider [0000000100253f68] core interface debug: using interface module "macosx" [0000000100414568] core libvlc debug: removing all interfaces [0000000100414568] core libvlc debug: exiting [0000000100253f68] core interface debug: removing module "macosx" [0000000100253b28] core interface debug: removing module "hotkeys" [000000010024b768] core playlist debug: destroying [000000010024b768] core playlist debug: deactivating the playlist [0000000100460a08] core audio output debug: removing module "auhal" [00000001088c62f8] core playlist export debug: saving Medienbibliothek to file /Users/frederik/Library/Application Support/org.videolan.vlc/ml.xspf.tmp75436 [00000001088c62f8] core playlist export debug: looking for playlist export module matching "export-xspf": 4 candidates [00000001088c62f8] core playlist export debug: using playlist export module "export" [00000001088c62f8] core playlist export debug: removing module "export"

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

Re: Customize http request headers

Postby Rémi Denis-Courmont » 06 Jul 2017 21:59

Pass --http-continuous. You will lose the ability to seek.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 12 guests