+2008-04-19 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * gst/gsturi.c: (gst_uri_protocol_check_internal),
+ (gst_uri_get_protocol), (gst_uri_has_protocol),
+ (gst_uri_construct), (gst_uri_handler_set_uri):
+ A valid URI scheme can also include '+', '-' and '.' additional
+ to alphanumeric characters as per RFC 3986 Section 3.1.
+
+ Handle URI schemes case insensitive in all places and convert
+ to lower-case when constructing an URI or setting an URI with
+ the GstURIHandler interface. Fixes bug #528868.
+ All elements can still assume (as before) that they will
+ get passed URIs with a lower-case URI scheme by the GstURIHandler
+ interface.
+
2008-04-17 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstcaps.c: (gst_static_caps_get):
if (g_ascii_isalpha (*check)) {
check++;
- while (g_ascii_isalnum (*check))
+ while (g_ascii_isalnum (*check) || *check == '+'
+ || *check == '-' || *check == '.')
check++;
}
* @protocol: A string
*
* Tests if the given string is a valid protocol identifier. Protocols
- * must consist of alphanumeric characters and not start with a number.
+ * must consist of alphanumeric characters, '+', '-' and '.' and must
+ * start with a alphabetic character. See RFC 3986 Section 3.1.
*
* Returns: TRUE if the string is a valid protocol identifier, FALSE otherwise.
*/
colon = strstr (uri, "://");
- return g_strdown (g_strndup (uri, colon - uri));
+ return g_ascii_strdown (g_strndup (uri, colon - uri), -1);
}
/**
if (colon == NULL)
return FALSE;
- return (strncmp (uri, protocol, (gsize) (colon - uri)) == 0);
+ return (g_ascii_strncasecmp (uri, protocol, (gsize) (colon - uri)) == 0);
}
/**
gchar *
gst_uri_construct (const gchar * protocol, const gchar * location)
{
- char *escaped;
+ char *escaped, *proto_lowercase;
char *retval;
g_return_val_if_fail (gst_uri_protocol_is_valid (protocol), NULL);
g_return_val_if_fail (location != NULL, NULL);
+ proto_lowercase = g_ascii_strdown (protocol, -1);
escaped = escape_string (location);
- retval = g_strdup_printf ("%s://%s", protocol, escaped);
+ retval = g_strdup_printf ("%s://%s", proto_lowercase, escaped);
g_free (escaped);
+ g_free (proto_lowercase);
return retval;
}
gst_uri_handler_set_uri (GstURIHandler * handler, const gchar * uri)
{
GstURIHandlerInterface *iface;
+ gboolean ret;
+ gchar *new_uri, *protocol, *location;
g_return_val_if_fail (GST_IS_URI_HANDLER (handler), FALSE);
g_return_val_if_fail (gst_uri_is_valid (uri), FALSE);
iface = GST_URI_HANDLER_GET_INTERFACE (handler);
g_return_val_if_fail (iface != NULL, FALSE);
g_return_val_if_fail (iface->set_uri != NULL, FALSE);
- return iface->set_uri (handler, uri);
+
+ protocol = gst_uri_get_protocol (uri);
+ location = gst_uri_get_location (uri);
+ new_uri = g_strdup_printf ("%s://%s", protocol, location);
+
+ ret = iface->set_uri (handler, uri);
+
+ g_free (new_uri);
+ g_free (location);
+ g_free (protocol);
+
+ return ret;
}
/**