mercredi 24 juin 2015

How to server flash policy file with socket-io 1.3.5 (node server)?

I'm trying to serve inline flash policy file on port 3000, but with no luck.

I can not catch any callback from flash policy call (<policy-file-request/>\0). And I don't know how to serve send policy file back to flash through the socket.

Somethig like this: Setting up a socket policy file server from Adobe

This is code from server:

var server   = require('http').createServer();
var io       = require('socket.io')(server);

var port = 3000;

var xml = '<?xml version="1.0"?>\n<!DOCTYPE cross-domain-policy SYSTEM \n"http://ift.tt/1d1B8yI">\n<cross-domain-policy>\n';
    xml += '<site-control permitted-cross-domain-policies="master-only"/>\n';
    xml += '<allow-access-from domain="*" to-ports="*"/>\n';
    xml += '</cross-domain-policy>\n';

io.on('connection', function (socket) {
    socket.on('<policy-file-request/>\0', function (data, callback) {
        console.log('socket policy-file-request 0');
        callback(xml);
    });
});

server.listen(port, function () {
    info('Server listening at ' + port);
});

And from client:

Security.loadPolicyFile("xmlsocket://example.com:3000");

Aucun commentaire:

Enregistrer un commentaire