Class: Funnel::Flash::Policy

Inherits:
Object
  • Object
show all
Defined in:
lib/funnel/flash/policy.rb

Class Method Summary collapse

Class Method Details

.responseObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/funnel/flash/policy.rb', line 5

def self.response
  settings = Funnel::Configuration
  accepted = settings.get(:accepted_origins)

  response = "<?xml version=\"1.0\"?>"
  response << "<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">"
  response << "<cross-domain-policy>"

  # use the configuration settings to determine who
  # can connect via the flash socket
  if accepted.empty?
    response << allow_tag("*")
  else
    accepted.each do |domain|
      response << allow_tag(domain)
    end
  end

  response << "</cross-domain-policy>"
  response
end