GNOME Bugzilla – Bug 403172
[filesrc] doesn't handle localhost file locations
Last modified: 2007-02-02 10:43:29 UTC
$ gst-launch gnomevfssrc location=file://localhost/home/bnocera/Music/file.mp3 ! fakesink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock Got EOS from element "pipeline0". Execution ended after 729841000 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... FREEING pipeline ... $ gst-launch playbin uri=file://localhost/home/bnocera/Music/file.mp3 Setting pipeline to PAUSED ... ERROR: Pipeline doesn't want to pause. ERROR: from element /playbin0/source: Resource not found. Additional debug info: gstfilesrc.c(975): gst_file_src_start (): /playbin0/source: No such file "localhost/home/bnocera/Music/file.mp3" Setting pipeline to NULL ... FREEING pipeline ... gstreamer-plugins-fluendo-windowsmedia-0.10-7.el5 gstreamer-plugins-good-0.10.4-1.fc6 gstreamer-plugins-good-devel-0.10.4-1.fc6 gstreamer-0.10.10-2.fc6 gstreamer-plugins-base-devel-0.10.10-1.fc6 gstreamer-plugins-fluendo-video-0.10-7.el5 gstreamer-tools-0.10.10-2.fc6 gstreamer-plugins-base-0.10.10-1.fc6 gstreamer-ffmpeg-0.10.2-0.3.20061108.lvn6 gstreamer-plugins-ugly-0.10.4-3.lvn6 gstreamer-plugins-fluendo-mp3-0.10-7.el5 gstreamer-plugins-base-0.10.9-4 gstreamer-devel-0.10.10-2.fc6
Sigh, is this really needed? Next thing we need to support file://myhostname/foo/bar.ogg and file://myipaddress/foo/bar.ogg etc.
It seems that gnomevfs-ls for example just strips everything between the second and third slash. Maybe we should just do the same for file:// URIs or just fail for everything else. RFC1738[1] seems to require support for the hostname part of file:// URIs... Shouldn't be that hard to implement unless we want to support myhostname and myipaddress and similar stuff as this would require some special magic to determine whether it belongs to this machine or something else. [1] http://www.rfc-editor.org/rfc/rfc1738.txt
(In reply to comment #1) > Sigh, is this really needed? file://localhost/blah should work... > Next thing we need to support file://myhostname/foo/bar.ogg and > file://myipaddress/foo/bar.ogg etc. Let me know how you think this would work ;) Just special-casing file://localhost/ should be fine.
Tim, what do you think? If you're fine with this I'll make a patch later to special-case file://localhost/ and just create a more meaningfull error if another hostname/ip is supplied.
> > Next thing we need to support file://myhostname/foo/bar.ogg and > > file://myipaddress/foo/bar.ogg etc. > > Let me know how you think this would work ;) gnomevfs-info appears to accept file://myhostname/foo/bar.ogg ;) > Just special-casing file://localhost/ should be fine. Fine with me. > (...) I'll make a patch later to special-case file://localhost/ > and just create a more meaningfull error if another hostname/ip > is supplied. Cool. Could we just do the following: - skip 'localhost' prefix in _set_uri() - otherwise, return FALSE in _set_uri() if the URI bit after protocol:// doesn't start with a '/' ?
gnomevfs-info accepts file://blablabla/foo/bar but it just strips the hostname part... i.e. every hostname is localhost. That would be another possibility but I would prefer the one you outlined, i.e. to just not accept anything else than localhost or no hostname. The gnomevfs behaviour is IMHO not compliant with the RFC.
Created attachment 81694 [details] [review] file-localhost.diff ok, here is it. works fine for me and if file://foobar/blabla is specified as URL gnomevfssrc is chosen as source (if installed) and handles it just fine (although the gnomevfs behaviour is arguably wrong)
Created attachment 81700 [details] [review] file-localhost.diff Instead of taking the (unescaped!) location directly construct a new URI without the localhost part and put it into gst_uri_get_location(), which also provides unescaping.
Committed... 2007-02-02 Sebastian Dröge <slomo@circular-chaos.org> reviewed by: Wim Taymans <wim@fluendo.com> * plugins/elements/gstfilesink.c: (gst_file_sink_uri_set_uri): * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): Allow file://localhost/foo/bar URLs and correctly fail for every other hostname that one sets. This was gnomevfssrc is linked for those if installed as it can handle it (#403172)