Created
July 7, 2010 10:10
-
-
Save skaurus/466525 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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; | |
} |
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
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 ;)