~jk0/nova/lp807749

« back to all changes in this revision

Viewing changes to bin/nova-vncproxy

  • Committer: Tarmac
  • Author(s): Jimmy Bergman
  • Date: 2011-07-07 07:26:01 UTC
  • mfrom: (1202.7.6 nova)
  • Revision ID: tarmac-20110707072601-042z3jzmg2s8cw00
Add a socket server responding with an allowing flash socket policy for all requests from flash on port 843 to nova-vncproxy

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
flags.DEFINE_flag(flags.HelpXMLFlag())
64
64
 
65
65
 
 
66
def handle_flash_socket_policy(socket):
 
67
    LOG.info(_("Received connection on flash socket policy port"))
 
68
 
 
69
    fd = socket.makefile('rw')
 
70
    expected_command = "<policy-file-request/>"
 
71
    if expected_command in fd.read(len(expected_command) + 1):
 
72
        LOG.info(_("Received valid flash socket policy request"))
 
73
        fd.write('<?xml version="1.0"?><cross-domain-policy><allow-'
 
74
                 'access-from domain="*" to-ports="%d" /></cross-'
 
75
                 'domain-policy>' % (FLAGS.vncproxy_port))
 
76
        fd.flush()
 
77
    socket.close()
 
78
 
66
79
if __name__ == "__main__":
67
80
    utils.default_flagfile()
68
81
    FLAGS(sys.argv)
101
114
                         host=FLAGS.vncproxy_host,
102
115
                         port=FLAGS.vncproxy_port)
103
116
    server.start()
 
117
    server.start_tcp(handle_flash_socket_policy, 843, host=FLAGS.vncproxy_host)
 
118
 
104
119
    server.wait()