Class: Heroku::Kensa::PostProxy

Inherits:
WEBrick::HTTPServer
  • Object
show all
Defined in:
lib/heroku/kensa/post_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(sso) ⇒ PostProxy



4
5
6
7
8
9
# File 'lib/heroku/kensa/post_proxy.rb', line 4

def initialize(sso)
  @params = sso.query_params
  @sso = sso
  super :Port => sso.proxy_port, :AccessLog => WEBrick::Log.new(StringIO.new),
          :Logger => WEBrick::Log.new(StringIO.new)
end

Instance Method Details

#service(req, res) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/heroku/kensa/post_proxy.rb', line 11

def service(req, res)
  res.status = 200
  res.body = "    <html>\n      <head>\n        <script type=\"text/javascript\">\n          window.onload = function() { document.forms[0].submit() }\n        </script>\n      </head>\n      <body>\n        <form action=\"\#{@sso.post_url}\" method=\"POST\">\n          \#{ @params.map do |key, value|\n              %|<input type=\"hidden\" name=\"\#{key}\" value=\"\#{value}\" />|\n             end.join(\"\\n\")\n           }\n        </form>\n      </body>\n    </html>\n  HTML\n  res[\"Content-Length\"] = res.body.size\n  @status = :Shutdown\nend\n"