FlashPolicyFileServer
?README.md
LOL,WUT?It basically allows you to allow or disallow Flash Player sockets from accessing your site. Installationnpm install policyfile
UsageThe server is based on the regular and know createServerCreates a new server instance and accepts 2 optional arguments:
var pf = require('policyfile').createServer();
pf.listen();
server.listenStart listening on the server and it takes 3 optional arguments
var pf = require('policyfile').createServer();
pf.listen(1337, function(){
console.log(':3 yay')
});
Changing port numbers can be handy if you do not want to run your server as root and have port 843 forward to a non root port number (aka a number above 1024). var pf = require('policyfile').createServer()
, http = require('http');
server = http.createServer(function(q,r){r.writeHead(200);r.end('hello world')});
server.listen(80);
pf.listen(1337, server, function(){
console.log(':3 yay')
});
Support for serving inline requests over a existing HTTP connection as the FlashPlayer will first check port 843,but if it's unable to get a response there it will send a policy file request over port 80,which is usually your http server. server.addAdds more origins to the policy file you can add as many arguments as you like. var pf = require('policyfile').createServer(['google.com:80']);
pf.listen();
pf.add('blog.3rd-Eden.com:80', 'blog.3rd-Eden.com:8080'); // now has 3 origins
server.removeRemoves added origins from the policy file - you can add as many arguments as you like. var pf = require('policyfile').createServer(['blog.3rd-Eden.com:80', 'blog.3rd-Eden.com:8080']);
pf.listen();
pf.remove('blog.3rd-Eden.com:8080'); // only contains the :80 version now
server.closeShuts down the server var pf = require('policyfile').createServer();
pf.listen();
pf.close(); // OH NVM.
APIhttp://3rd-eden.com/FlashPolicyFileServer/ ExamplesSee https://github.com/3rd-Eden/FlashPolicyFileServer/tree/master/examples for examples LicenceMIT see LICENSE file in the repository (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |