From de451f8f15c4e159fb96c182e9477bbd190eb55e Mon Sep 17 00:00:00 2001 From: James Bowes Date: Tue, 8 Apr 2008 17:38:23 -0400 Subject: [PATCH] Allow loading streams from the same domain as the flash file. Some flash files don't use relative URLs to load files on the same server. This should be allowed without looking for the crossdomain.xml file. --- swfdec/swfdec_load_object.c | 4 ++++ swfdec/swfdec_url.c | 37 ++++++++++++++++++++++++++++++------- swfdec/swfdec_url.h | 2 ++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/swfdec/swfdec_load_object.c b/swfdec/swfdec_load_object.c index d7bc0ce..2e29940 100644 --- a/swfdec/swfdec_load_object.c +++ b/swfdec/swfdec_load_object.c @@ -193,6 +193,10 @@ swfdec_load_object_request (gpointer objectp, gpointer playerp) } switch (load->sandbox->type) { case SWFDEC_SANDBOX_REMOTE: + if (swfdec_url_host_equal(url, swfdec_player_get_url (player))) { + swfdec_load_object_load (player, TRUE, load); + return; + } case SWFDEC_SANDBOX_LOCAL_NETWORK: case SWFDEC_SANDBOX_LOCAL_TRUSTED: if (swfdec_url_is_local (url)) { diff --git a/swfdec/swfdec_url.c b/swfdec/swfdec_url.c index 3a041d3..14476a6 100644 --- a/swfdec/swfdec_url.c +++ b/swfdec/swfdec_url.c @@ -525,19 +525,18 @@ swfdec_url_is_local (const SwfdecURL *url) } /** - * swfdec_url_equal: + * swfdec_url_host_equal: * @a: a #SwfdecURL * @b: a #SwfdecURL * - * Compares the 2 given URLs for equality. 2 URLs are considered equal, when - * they point to the same resource. This function is intended to be - * used together with swfdec_url_hash() in a #GHashtable. - * - * Returns: %TRUE if the 2 given urls point to the same resource, %FALSE + * Compares the 2 given URLs for equality, ignoring path. 2 URLs are + * considered to have equal hosts when they have the same protocol, + * host, and port. + * Returns: %TRUE if the 2 given urls point to the same host, %FALSE * otherwise. **/ gboolean -swfdec_url_equal (gconstpointer a, gconstpointer b) +swfdec_url_host_equal (gconstpointer a, gconstpointer b) { const SwfdecURL *urla = a; const SwfdecURL *urlb = b; @@ -557,6 +556,30 @@ swfdec_url_equal (gconstpointer a, gconstpointer b) if (urla->port != urlb->port) return FALSE; + return TRUE; +} + +/** + * swfdec_url_equal: + * @a: a #SwfdecURL + * @b: a #SwfdecURL + * + * Compares the 2 given URLs for equality. 2 URLs are considered equal, when + * they point to the same resource. This function is intended to be + * used together with swfdec_url_hash() in a #GHashtable. + * + * Returns: %TRUE if the 2 given urls point to the same resource, %FALSE + * otherwise. + **/ +gboolean +swfdec_url_equal (gconstpointer a, gconstpointer b) +{ + const SwfdecURL *urla = a; + const SwfdecURL *urlb = b; + + if (!swfdec_url_host_equal (urla, urlb)) + return FALSE; + if (urla->path == NULL) { if (urlb->path != NULL) return FALSE; diff --git a/swfdec/swfdec_url.h b/swfdec/swfdec_url.h index a7d8c13..eb26bfc 100644 --- a/swfdec/swfdec_url.h +++ b/swfdec/swfdec_url.h @@ -57,6 +57,8 @@ gboolean swfdec_url_is_parent (const SwfdecURL * parent, const SwfdecURL * child); gboolean swfdec_url_is_local (const SwfdecURL * url); +gboolean swfdec_url_host_equal (gconstpointer a, + gconstpointer b); gboolean swfdec_url_equal (gconstpointer a, gconstpointer b); guint swfdec_url_hash (gconstpointer url); -- 1.5.5.144.g3e42