Jump to content

Returning a clientaccesspolicy.xml or crossdomain.xml file with WebUI


grimstoner

Recommended Posts

Posted

Hi

I'm trying to do a Silverlight interface for uTorrent, which requires the base address to return either a crossdomain.xml or clientaccesspolicy.xml (i.e. http://my.utorrentserver.com:myport/clientaccesspolicy.xml).

I've tried adding a clientaccesspolicy.xml file to the WebUI zip file, but when I try to request the above Uri, I get a "invalid request".

Is there any way to return a clientaccesspolicy.xml/crossdomain.xml file?

Reference :

http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx

http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html

Posted

In main.js, there's a function that builds a token response in response to the request http://my.utorrentserver.com:12345/token.html called (lo and behold) requestToken. I can write another function to return the contents of my clientaccesspolicy, i.e. something like this (I'm not a Java dev, so regard it as pseudocode) :


requestPolicy: function (c,
{
var a = this;
try
{
new Request(
{
url: urlBase + "clientaccesspolicy.xml?t=" + $time(),
method: "get",
async: !! b,
onFailure: (c) ? c.bind(a) : $empty,
onSuccess: function (e)
{
a = "<?xml version="1.0" encoding="utf-8"?><access-policy><cross-domain-access><policy><allow-from> <domain uri="*"/></allow-from><grant-to><resource path="/api" include-subpaths="false"/></grant-to></policy></cross-domain-access></access-policy>";
if (c)
{
c.delay(0)
}
}
}).send()
}
catch (d)
{
}
}

but, how do I get the app to call the function whenever a request is made to http://my.utorrentserver.com:12345/clientaccesspolicy.xml?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...