Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save skaurus/466525 to your computer and use it in GitHub Desktop.
Save skaurus/466525 to your computer and use it in GitHub Desktop.
--- new3.js 2010-07-07 10:07:46.000000000 +0000
+++ ws_my.js 2010-07-07 10:08:53.000000000 +0000
@@ -52,7 +52,10 @@
policy_file = '<cross-domain-policy><allow-access-from domain="*" to-ports="*" /></cross-domain-policy>';
-exports.createServer = function (websocketListener) {
+exports.createServer = function (websocketListener, options) {
+ if (!options) options = {};
+ if (!options.flashpolicy) options.flashpolicy = policy_file;
+
return net.createServer(function (socket) {
socket.setTimeout(0);
socket.setNoDelay(true);
@@ -85,7 +88,7 @@
var _headers = data.split("\r\n");
if ( /<policy-file-request.*>/.exec(_headers[0]) ) {
- socket.write(policy_file);
+ socket.write( options.flashpolicy );
socket.end();
return;
}
@ncr
Copy link

ncr commented Jul 7, 2010

Could you change options.flashpolicy to options.flashPolicy and policy_file to flashPolicy too for consistency? I'll merge it as soon as I get pull request ;)

@skaurus
Copy link
Author

skaurus commented Jul 7, 2010

Ok, I'll rename it in a few moments and issue another pull request :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment