mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
plugins/elements/: Allow file://localhost/foo/bar URLs and correctly fail for every other hostname that one sets. Thi...
Original commit message from CVS: 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)
This commit is contained in:
parent
c50cb6a421
commit
b3c3d335cf
3 changed files with 46 additions and 2 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
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)
|
||||
|
||||
2007-02-01 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
reviewed by: Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
|
|
@ -542,7 +542,24 @@ gst_file_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
|||
return FALSE;
|
||||
}
|
||||
g_free (protocol);
|
||||
location = gst_uri_get_location (uri);
|
||||
|
||||
/* allow file://localhost/foo/bar by stripping localhost but fail
|
||||
* for every other hostname */
|
||||
if (g_str_has_prefix (uri, "file://localhost/")) {
|
||||
char *tmp;
|
||||
|
||||
/* 16 == strlen ("file://localhost") */
|
||||
tmp = g_strconcat ("file://", uri + 16, NULL);
|
||||
/* we use gst_uri_get_location() although we already have the
|
||||
* "location" with uri + 16 because it provides unescaping */
|
||||
location = gst_uri_get_location (tmp);
|
||||
g_free (tmp);
|
||||
} else if (!g_str_has_prefix (uri, "file:///")) {
|
||||
return FALSE;
|
||||
} else {
|
||||
location = gst_uri_get_location (uri);
|
||||
}
|
||||
|
||||
ret = gst_file_sink_set_location (sink, location);
|
||||
g_free (location);
|
||||
|
||||
|
|
|
@ -1062,7 +1062,24 @@ gst_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
|||
return FALSE;
|
||||
}
|
||||
g_free (protocol);
|
||||
location = gst_uri_get_location (uri);
|
||||
|
||||
/* allow file://localhost/foo/bar by stripping localhost but fail
|
||||
* for every other hostname */
|
||||
if (g_str_has_prefix (uri, "file://localhost/")) {
|
||||
char *tmp;
|
||||
|
||||
/* 16 == strlen ("file://localhost") */
|
||||
tmp = g_strconcat ("file://", uri + 16, NULL);
|
||||
/* we use gst_uri_get_location() although we already have the
|
||||
* "location" with uri + 16 because it provides unescaping */
|
||||
location = gst_uri_get_location (tmp);
|
||||
g_free (tmp);
|
||||
} else if (!g_str_has_prefix (uri, "file:///")) {
|
||||
return FALSE;
|
||||
} else {
|
||||
location = gst_uri_get_location (uri);
|
||||
}
|
||||
|
||||
ret = gst_file_src_set_location (src, location);
|
||||
g_free (location);
|
||||
|
||||
|
|
Loading…
Reference in a new issue