[tor-commits] [flashproxy/master] Serve /crossdomain.xml.

dcf at torproject.org dcf at torproject.org
Fri Jun 10 13:59:53 UTC 2011


commit 8eb56ea0f43e48fecf8a564005c8446ca3477448
Author: David Fifield <david at bamsoftware.com>
Date:   Fri May 20 05:17:00 2011 -0700

    Serve /crossdomain.xml.
---
 facilitator.py |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/facilitator.py b/facilitator.py
index 56a9774..5c33ea2 100755
--- a/facilitator.py
+++ b/facilitator.py
@@ -11,6 +11,7 @@ import sys
 import threading
 import time
 import urllib
+import urlparse
 
 DEFAULT_ADDRESS = "0.0.0.0"
 DEFAULT_PORT = 9002
@@ -191,6 +192,12 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
     def do_GET(self):
         log(u"proxy %s connects" % format_addr(self.client_address))
 
+        path = urlparse.urlsplit(self.path)[2]
+
+        if path == u"/crossdomain.xml":
+            self.send_crossdomain()
+            return
+
         reg = REGS.fetch()
         if reg:
             log(u"proxy %s gets %s (now %d)" % (format_addr(self.client_address), unicode(reg), len(REGS)))
@@ -231,6 +238,19 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
         self.send_response(200)
         self.end_headers()
 
+    def send_crossdomain(self):
+        crossdomain = """\
+<cross-domain-policy>
+<allow-access-from domain="*"/>
+</cross-domain-policy>
+"""
+        self.send_response(200)
+        # Content-Type must be one of a few whitelisted types.
+        # http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html#_Content-Type_Whitelist
+        self.send_header("Content-Type", "application/xml")
+        self.end_headers()
+        self.wfile.write(crossdomain)
+
     def send_error(self, code, message = None):
         self.send_response(code)
         self.end_headers()





More information about the tor-commits mailing list