5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/devproxy/cli/server.rb', line 5
def do_GET(request,response)
token = request.cookies.detect { |x| x.name == "DEVPROXY" }
token &&= token.value
token ||= "none"
sysname = "#{%x{whoami}}@#{%x{hostname}}"
response.status = 200
response['Content-Type'] = "text/html"
response.body = %{
<html>
<head>
<link rel="stylesheet" href="/css/style.css">
<title>Devproxy Test Server</title>
</head>
<body>
<h1>Hello from #{h(sysname)}</h2>
<div class="details">
<table>
<caption>Tunnel Details</caption>
<tbody>
<tr>
<td>host</td><td>#{h(request.host)}</td>
</tr>
<tr>
<td>protocol</td><td>#{h(request['x-forwarded-proto'])}</td>
</tr>
<tr>
<td>token</td><td>#{h(token)}</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
}
end
|