passenger 2.2.7 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data/NEWS +40 -0
- data/Rakefile +1 -1
- data/bin/passenger-install-apache2-module +1 -0
- data/bin/passenger-install-nginx-module +2 -0
- data/doc/Architectural overview.html +173 -138
- data/doc/Security of user switching support.html +147 -109
- data/doc/Users guide Apache.html +4 -43
- data/doc/Users guide Nginx.html +4 -43
- data/doc/cxxapi/Bucket_8h-source.html +1 -1
- data/doc/cxxapi/Configuration_8h-source.html +1 -1
- data/doc/cxxapi/DirectoryMapper_8h-source.html +1 -1
- data/doc/cxxapi/Hooks_8h-source.html +1 -1
- data/doc/cxxapi/annotated.html +1 -1
- data/doc/cxxapi/classHooks-members.html +1 -1
- data/doc/cxxapi/classHooks.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +1 -1
- data/doc/cxxapi/classes.html +1 -1
- data/doc/cxxapi/definitions_8h-source.html +1 -1
- data/doc/cxxapi/files.html +1 -1
- data/doc/cxxapi/functions.html +1 -1
- data/doc/cxxapi/functions_func.html +1 -1
- data/doc/cxxapi/graph_legend.html +1 -1
- data/doc/cxxapi/group__Configuration.html +1 -1
- data/doc/cxxapi/group__Core.html +1 -1
- data/doc/cxxapi/group__Hooks.html +1 -1
- data/doc/cxxapi/group__Support.html +1 -1
- data/doc/cxxapi/main.html +1 -1
- data/doc/cxxapi/modules.html +1 -1
- data/doc/rdoc/classes/GC.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger.html +2 -1
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +8 -8
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +26 -26
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +98 -98
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +61 -61
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/Application.html +14 -14
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +12 -12
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +12 -12
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +5 -5
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +42 -42
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +33 -33
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +59 -59
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +3 -3
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +7 -7
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +23 -23
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +4 -4
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +2 -0
- data/doc/rdoc/classes/PhusionPassenger/Utils/PseudoIO.html +16 -16
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +4 -4
- data/doc/rdoc/classes/PlatformInfo.html +1 -1
- data/doc/rdoc/classes/Signal.html +23 -15
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/DEVELOPERS_TXT.html +1 -1
- data/doc/rdoc/files/README.html +1 -1
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +2 -2
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +2 -2
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +9 -9
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +1 -1
- data/doc/rdoc/files/misc/rake/extensions_rb.html +1 -1
- data/doc/rdoc/fr_class_index.html +2 -0
- data/doc/rdoc/fr_file_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +79 -72
- data/ext/apache2/Hooks.cpp +4 -2
- data/ext/common/StandardApplicationPool.h +4 -2
- data/ext/common/Version.h +1 -1
- data/ext/nginx/Configuration.c +1 -1
- data/ext/oxt/system_calls.cpp +11 -0
- data/ext/oxt/system_calls.hpp +2 -1
- data/ext/oxt/thread.hpp +97 -1
- data/lib/phusion_passenger/constants.rb +1 -1
- data/lib/phusion_passenger/dependencies.rb +32 -0
- data/lib/phusion_passenger/platform_info.rb +1 -1
- data/lib/phusion_passenger/rack/application_spawner.rb +4 -4
- data/lib/phusion_passenger/rack/request_handler.rb +2 -5
- data/lib/phusion_passenger/railz/application_spawner.rb +13 -2
- data/lib/phusion_passenger/utils.rb +12 -4
- data/{vendor/rack-1.0.0-git/lib/rack → lib/phusion_passenger/utils}/rewindable_input.rb +19 -3
- data/test/ApplicationPoolTest.cpp +1 -1
- metadata +13 -59
- data/vendor/README +0 -13
- data/vendor/README_FOR_PACKAGERS +0 -1
- data/vendor/rack-1.0.0-git/COPYING +0 -18
- data/vendor/rack-1.0.0-git/KNOWN-ISSUES +0 -18
- data/vendor/rack-1.0.0-git/README +0 -353
- data/vendor/rack-1.0.0-git/Rakefile +0 -164
- data/vendor/rack-1.0.0-git/lib/rack.rb +0 -90
- data/vendor/rack-1.0.0-git/lib/rack/adapter/camping.rb +0 -22
- data/vendor/rack-1.0.0-git/lib/rack/auth/abstract/handler.rb +0 -37
- data/vendor/rack-1.0.0-git/lib/rack/auth/abstract/request.rb +0 -37
- data/vendor/rack-1.0.0-git/lib/rack/auth/basic.rb +0 -58
- data/vendor/rack-1.0.0-git/lib/rack/auth/digest/md5.rb +0 -124
- data/vendor/rack-1.0.0-git/lib/rack/auth/digest/nonce.rb +0 -51
- data/vendor/rack-1.0.0-git/lib/rack/auth/digest/params.rb +0 -55
- data/vendor/rack-1.0.0-git/lib/rack/auth/digest/request.rb +0 -40
- data/vendor/rack-1.0.0-git/lib/rack/auth/openid.rb +0 -487
- data/vendor/rack-1.0.0-git/lib/rack/builder.rb +0 -63
- data/vendor/rack-1.0.0-git/lib/rack/cascade.rb +0 -41
- data/vendor/rack-1.0.0-git/lib/rack/chunked.rb +0 -49
- data/vendor/rack-1.0.0-git/lib/rack/commonlogger.rb +0 -52
- data/vendor/rack-1.0.0-git/lib/rack/conditionalget.rb +0 -47
- data/vendor/rack-1.0.0-git/lib/rack/content_length.rb +0 -29
- data/vendor/rack-1.0.0-git/lib/rack/content_type.rb +0 -23
- data/vendor/rack-1.0.0-git/lib/rack/deflater.rb +0 -96
- data/vendor/rack-1.0.0-git/lib/rack/directory.rb +0 -153
- data/vendor/rack-1.0.0-git/lib/rack/file.rb +0 -88
- data/vendor/rack-1.0.0-git/lib/rack/handler.rb +0 -69
- data/vendor/rack-1.0.0-git/lib/rack/handler/cgi.rb +0 -61
- data/vendor/rack-1.0.0-git/lib/rack/handler/evented_mongrel.rb +0 -8
- data/vendor/rack-1.0.0-git/lib/rack/handler/fastcgi.rb +0 -88
- data/vendor/rack-1.0.0-git/lib/rack/handler/lsws.rb +0 -55
- data/vendor/rack-1.0.0-git/lib/rack/handler/mongrel.rb +0 -84
- data/vendor/rack-1.0.0-git/lib/rack/handler/scgi.rb +0 -59
- data/vendor/rack-1.0.0-git/lib/rack/handler/swiftiplied_mongrel.rb +0 -8
- data/vendor/rack-1.0.0-git/lib/rack/handler/thin.rb +0 -18
- data/vendor/rack-1.0.0-git/lib/rack/handler/webrick.rb +0 -67
- data/vendor/rack-1.0.0-git/lib/rack/head.rb +0 -19
- data/vendor/rack-1.0.0-git/lib/rack/lint.rb +0 -537
- data/vendor/rack-1.0.0-git/lib/rack/lobster.rb +0 -65
- data/vendor/rack-1.0.0-git/lib/rack/lock.rb +0 -16
- data/vendor/rack-1.0.0-git/lib/rack/methodoverride.rb +0 -27
- data/vendor/rack-1.0.0-git/lib/rack/mime.rb +0 -204
- data/vendor/rack-1.0.0-git/lib/rack/mock.rb +0 -184
- data/vendor/rack-1.0.0-git/lib/rack/recursive.rb +0 -57
- data/vendor/rack-1.0.0-git/lib/rack/reloader.rb +0 -106
- data/vendor/rack-1.0.0-git/lib/rack/request.rb +0 -248
- data/vendor/rack-1.0.0-git/lib/rack/response.rb +0 -183
- data/vendor/rack-1.0.0-git/lib/rack/session/abstract/id.rb +0 -142
- data/vendor/rack-1.0.0-git/lib/rack/session/cookie.rb +0 -91
- data/vendor/rack-1.0.0-git/lib/rack/session/memcache.rb +0 -109
- data/vendor/rack-1.0.0-git/lib/rack/session/pool.rb +0 -100
- data/vendor/rack-1.0.0-git/lib/rack/showexceptions.rb +0 -349
- data/vendor/rack-1.0.0-git/lib/rack/showstatus.rb +0 -106
- data/vendor/rack-1.0.0-git/lib/rack/static.rb +0 -38
- data/vendor/rack-1.0.0-git/lib/rack/urlmap.rb +0 -55
- data/vendor/rack-1.0.0-git/lib/rack/utils.rb +0 -522
@@ -1,142 +0,0 @@
|
|
1
|
-
# AUTHOR: blink <blinketje@gmail.com>; blink#ruby-lang@irc.freenode.net
|
2
|
-
# bugrep: Andreas Zehnder
|
3
|
-
|
4
|
-
require 'time'
|
5
|
-
require 'rack/request'
|
6
|
-
require 'rack/response'
|
7
|
-
|
8
|
-
module Rack
|
9
|
-
|
10
|
-
module Session
|
11
|
-
|
12
|
-
module Abstract
|
13
|
-
|
14
|
-
# ID sets up a basic framework for implementing an id based sessioning
|
15
|
-
# service. Cookies sent to the client for maintaining sessions will only
|
16
|
-
# contain an id reference. Only #get_session and #set_session are
|
17
|
-
# required to be overwritten.
|
18
|
-
#
|
19
|
-
# All parameters are optional.
|
20
|
-
# * :key determines the name of the cookie, by default it is
|
21
|
-
# 'rack.session'
|
22
|
-
# * :path, :domain, :expire_after, :secure, and :httponly set the related
|
23
|
-
# cookie options as by Rack::Response#add_cookie
|
24
|
-
# * :defer will not set a cookie in the response.
|
25
|
-
# * :renew (implementation dependent) will prompt the generation of a new
|
26
|
-
# session id, and migration of data to be referenced at the new id. If
|
27
|
-
# :defer is set, it will be overridden and the cookie will be set.
|
28
|
-
# * :sidbits sets the number of bits in length that a generated session
|
29
|
-
# id will be.
|
30
|
-
#
|
31
|
-
# These options can be set on a per request basis, at the location of
|
32
|
-
# env['rack.session.options']. Additionally the id of the session can be
|
33
|
-
# found within the options hash at the key :id. It is highly not
|
34
|
-
# recommended to change its value.
|
35
|
-
#
|
36
|
-
# Is Rack::Utils::Context compatible.
|
37
|
-
|
38
|
-
class ID
|
39
|
-
DEFAULT_OPTIONS = {
|
40
|
-
:path => '/',
|
41
|
-
:domain => nil,
|
42
|
-
:expire_after => nil,
|
43
|
-
:secure => false,
|
44
|
-
:httponly => true,
|
45
|
-
:defer => false,
|
46
|
-
:renew => false,
|
47
|
-
:sidbits => 128
|
48
|
-
}
|
49
|
-
|
50
|
-
attr_reader :key, :default_options
|
51
|
-
def initialize(app, options={})
|
52
|
-
@app = app
|
53
|
-
@key = options[:key] || "rack.session"
|
54
|
-
@default_options = self.class::DEFAULT_OPTIONS.merge(options)
|
55
|
-
end
|
56
|
-
|
57
|
-
def call(env)
|
58
|
-
context(env)
|
59
|
-
end
|
60
|
-
|
61
|
-
def context(env, app=@app)
|
62
|
-
load_session(env)
|
63
|
-
status, headers, body = app.call(env)
|
64
|
-
commit_session(env, status, headers, body)
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
# Generate a new session id using Ruby #rand. The size of the
|
70
|
-
# session id is controlled by the :sidbits option.
|
71
|
-
# Monkey patch this to use custom methods for session id generation.
|
72
|
-
|
73
|
-
def generate_sid
|
74
|
-
"%0#{@default_options[:sidbits] / 4}x" %
|
75
|
-
rand(2**@default_options[:sidbits] - 1)
|
76
|
-
end
|
77
|
-
|
78
|
-
# Extracts the session id from provided cookies and passes it and the
|
79
|
-
# environment to #get_session. It then sets the resulting session into
|
80
|
-
# 'rack.session', and places options and session metadata into
|
81
|
-
# 'rack.session.options'.
|
82
|
-
|
83
|
-
def load_session(env)
|
84
|
-
request = Rack::Request.new(env)
|
85
|
-
session_id = request.cookies[@key]
|
86
|
-
|
87
|
-
begin
|
88
|
-
session_id, session = get_session(env, session_id)
|
89
|
-
env['rack.session'] = session
|
90
|
-
rescue
|
91
|
-
env['rack.session'] = Hash.new
|
92
|
-
end
|
93
|
-
|
94
|
-
env['rack.session.options'] = @default_options.
|
95
|
-
merge(:id => session_id)
|
96
|
-
end
|
97
|
-
|
98
|
-
# Acquires the session from the environment and the session id from
|
99
|
-
# the session options and passes them to #set_session. If successful
|
100
|
-
# and the :defer option is not true, a cookie will be added to the
|
101
|
-
# response with the session's id.
|
102
|
-
|
103
|
-
def commit_session(env, status, headers, body)
|
104
|
-
session = env['rack.session']
|
105
|
-
options = env['rack.session.options']
|
106
|
-
session_id = options[:id]
|
107
|
-
|
108
|
-
if not session_id = set_session(env, session_id, session, options)
|
109
|
-
env["rack.errors"].puts("Warning! #{self.class.name} failed to save session. Content dropped.")
|
110
|
-
[status, headers, body]
|
111
|
-
elsif options[:defer] and not options[:renew]
|
112
|
-
env["rack.errors"].puts("Defering cookie for #{session_id}") if $VERBOSE
|
113
|
-
[status, headers, body]
|
114
|
-
else
|
115
|
-
cookie = Hash.new
|
116
|
-
cookie[:value] = session_id
|
117
|
-
cookie[:expires] = Time.now + options[:expire_after] unless options[:expire_after].nil?
|
118
|
-
response = Rack::Response.new(body, status, headers)
|
119
|
-
response.set_cookie(@key, cookie.merge(options))
|
120
|
-
response.to_a
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
# All thread safety and session retrival proceedures should occur here.
|
125
|
-
# Should return [session_id, session].
|
126
|
-
# If nil is provided as the session id, generation of a new valid id
|
127
|
-
# should occur within.
|
128
|
-
|
129
|
-
def get_session(env, sid)
|
130
|
-
raise '#get_session not implemented.'
|
131
|
-
end
|
132
|
-
|
133
|
-
# All thread safety and session storage proceedures should occur here.
|
134
|
-
# Should return true or false dependant on whether or not the session
|
135
|
-
# was saved or not.
|
136
|
-
def set_session(env, sid, session, options)
|
137
|
-
raise '#set_session not implemented.'
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'openssl'
|
2
|
-
require 'rack/request'
|
3
|
-
require 'rack/response'
|
4
|
-
|
5
|
-
module Rack
|
6
|
-
|
7
|
-
module Session
|
8
|
-
|
9
|
-
# Rack::Session::Cookie provides simple cookie based session management.
|
10
|
-
# The session is a Ruby Hash stored as base64 encoded marshalled data
|
11
|
-
# set to :key (default: rack.session).
|
12
|
-
# When the secret key is set, cookie data is checked for data integrity.
|
13
|
-
#
|
14
|
-
# Example:
|
15
|
-
#
|
16
|
-
# use Rack::Session::Cookie, :key => 'rack.session',
|
17
|
-
# :domain => 'foo.com',
|
18
|
-
# :path => '/',
|
19
|
-
# :expire_after => 2592000,
|
20
|
-
# :secret => 'change_me'
|
21
|
-
#
|
22
|
-
# All parameters are optional.
|
23
|
-
|
24
|
-
class Cookie
|
25
|
-
|
26
|
-
def initialize(app, options={})
|
27
|
-
@app = app
|
28
|
-
@key = options[:key] || "rack.session"
|
29
|
-
@secret = options[:secret]
|
30
|
-
@default_options = {:domain => nil,
|
31
|
-
:path => "/",
|
32
|
-
:expire_after => nil}.merge(options)
|
33
|
-
end
|
34
|
-
|
35
|
-
def call(env)
|
36
|
-
load_session(env)
|
37
|
-
status, headers, body = @app.call(env)
|
38
|
-
commit_session(env, status, headers, body)
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def load_session(env)
|
44
|
-
request = Rack::Request.new(env)
|
45
|
-
session_data = request.cookies[@key]
|
46
|
-
|
47
|
-
if @secret && session_data
|
48
|
-
session_data, digest = session_data.split("--")
|
49
|
-
session_data = nil unless digest == generate_hmac(session_data)
|
50
|
-
end
|
51
|
-
|
52
|
-
begin
|
53
|
-
session_data = session_data.unpack("m*").first
|
54
|
-
session_data = Marshal.load(session_data)
|
55
|
-
env["rack.session"] = session_data
|
56
|
-
rescue
|
57
|
-
env["rack.session"] = Hash.new
|
58
|
-
end
|
59
|
-
|
60
|
-
env["rack.session.options"] = @default_options.dup
|
61
|
-
end
|
62
|
-
|
63
|
-
def commit_session(env, status, headers, body)
|
64
|
-
session_data = Marshal.dump(env["rack.session"])
|
65
|
-
session_data = [session_data].pack("m*")
|
66
|
-
|
67
|
-
if @secret
|
68
|
-
session_data = "#{session_data}--#{generate_hmac(session_data)}"
|
69
|
-
end
|
70
|
-
|
71
|
-
if session_data.size > (4096 - @key.size)
|
72
|
-
env["rack.errors"].puts("Warning! Rack::Session::Cookie data size exceeds 4K. Content dropped.")
|
73
|
-
[status, headers, body]
|
74
|
-
else
|
75
|
-
options = env["rack.session.options"]
|
76
|
-
cookie = Hash.new
|
77
|
-
cookie[:value] = session_data
|
78
|
-
cookie[:expires] = Time.now + options[:expire_after] unless options[:expire_after].nil?
|
79
|
-
response = Rack::Response.new(body, status, headers)
|
80
|
-
response.set_cookie(@key, cookie.merge(options))
|
81
|
-
response.to_a
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def generate_hmac(data)
|
86
|
-
OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA1.new, @secret, data)
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# AUTHOR: blink <blinketje@gmail.com>; blink#ruby-lang@irc.freenode.net
|
2
|
-
|
3
|
-
require 'rack/session/abstract/id'
|
4
|
-
require 'memcache'
|
5
|
-
|
6
|
-
module Rack
|
7
|
-
module Session
|
8
|
-
# Rack::Session::Memcache provides simple cookie based session management.
|
9
|
-
# Session data is stored in memcached. The corresponding session key is
|
10
|
-
# maintained in the cookie.
|
11
|
-
# You may treat Session::Memcache as you would Session::Pool with the
|
12
|
-
# following caveats.
|
13
|
-
#
|
14
|
-
# * Setting :expire_after to 0 would note to the Memcache server to hang
|
15
|
-
# onto the session data until it would drop it according to it's own
|
16
|
-
# specifications. However, the cookie sent to the client would expire
|
17
|
-
# immediately.
|
18
|
-
#
|
19
|
-
# Note that memcache does drop data before it may be listed to expire. For
|
20
|
-
# a full description of behaviour, please see memcache's documentation.
|
21
|
-
|
22
|
-
class Memcache < Abstract::ID
|
23
|
-
attr_reader :mutex, :pool
|
24
|
-
DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge \
|
25
|
-
:namespace => 'rack:session',
|
26
|
-
:memcache_server => 'localhost:11211'
|
27
|
-
|
28
|
-
def initialize(app, options={})
|
29
|
-
super
|
30
|
-
|
31
|
-
@mutex = Mutex.new
|
32
|
-
@pool = MemCache.
|
33
|
-
new @default_options[:memcache_server], @default_options
|
34
|
-
raise 'No memcache servers' unless @pool.servers.any?{|s|s.alive?}
|
35
|
-
end
|
36
|
-
|
37
|
-
def generate_sid
|
38
|
-
loop do
|
39
|
-
sid = super
|
40
|
-
break sid unless @pool.get(sid, true)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def get_session(env, sid)
|
45
|
-
session = @pool.get(sid) if sid
|
46
|
-
@mutex.lock if env['rack.multithread']
|
47
|
-
unless sid and session
|
48
|
-
env['rack.errors'].puts("Session '#{sid.inspect}' not found, initializing...") if $VERBOSE and not sid.nil?
|
49
|
-
session = {}
|
50
|
-
sid = generate_sid
|
51
|
-
ret = @pool.add sid, session
|
52
|
-
raise "Session collision on '#{sid.inspect}'" unless /^STORED/ =~ ret
|
53
|
-
end
|
54
|
-
session.instance_variable_set('@old', {}.merge(session))
|
55
|
-
return [sid, session]
|
56
|
-
rescue MemCache::MemCacheError, Errno::ECONNREFUSED # MemCache server cannot be contacted
|
57
|
-
warn "#{self} is unable to find server."
|
58
|
-
warn $!.inspect
|
59
|
-
return [ nil, {} ]
|
60
|
-
ensure
|
61
|
-
@mutex.unlock if env['rack.multithread']
|
62
|
-
end
|
63
|
-
|
64
|
-
def set_session(env, session_id, new_session, options)
|
65
|
-
expiry = options[:expire_after]
|
66
|
-
expiry = expiry.nil? ? 0 : expiry + 1
|
67
|
-
|
68
|
-
@mutex.lock if env['rack.multithread']
|
69
|
-
session = @pool.get(session_id) || {}
|
70
|
-
if options[:renew] or options[:drop]
|
71
|
-
@pool.delete session_id
|
72
|
-
return false if options[:drop]
|
73
|
-
session_id = generate_sid
|
74
|
-
@pool.add session_id, 0 # so we don't worry about cache miss on #set
|
75
|
-
end
|
76
|
-
old_session = new_session.instance_variable_get('@old') || {}
|
77
|
-
session = merge_sessions session_id, old_session, new_session, session
|
78
|
-
@pool.set session_id, session, expiry
|
79
|
-
return session_id
|
80
|
-
rescue MemCache::MemCacheError, Errno::ECONNREFUSED # MemCache server cannot be contacted
|
81
|
-
warn "#{self} is unable to find server."
|
82
|
-
warn $!.inspect
|
83
|
-
return false
|
84
|
-
ensure
|
85
|
-
@mutex.unlock if env['rack.multithread']
|
86
|
-
end
|
87
|
-
|
88
|
-
private
|
89
|
-
|
90
|
-
def merge_sessions sid, old, new, cur=nil
|
91
|
-
cur ||= {}
|
92
|
-
unless Hash === old and Hash === new
|
93
|
-
warn 'Bad old or new sessions provided.'
|
94
|
-
return cur
|
95
|
-
end
|
96
|
-
|
97
|
-
delete = old.keys - new.keys
|
98
|
-
warn "//@#{sid}: delete #{delete*','}" if $VERBOSE and not delete.empty?
|
99
|
-
delete.each{|k| cur.delete k }
|
100
|
-
|
101
|
-
update = new.keys.select{|k| new[k] != old[k] }
|
102
|
-
warn "//@#{sid}: update #{update*','}" if $VERBOSE and not update.empty?
|
103
|
-
update.each{|k| cur[k] = new[k] }
|
104
|
-
|
105
|
-
cur
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
# AUTHOR: blink <blinketje@gmail.com>; blink#ruby-lang@irc.freenode.net
|
2
|
-
# THANKS:
|
3
|
-
# apeiros, for session id generation, expiry setup, and threadiness
|
4
|
-
# sergio, threadiness and bugreps
|
5
|
-
|
6
|
-
require 'rack/session/abstract/id'
|
7
|
-
require 'thread'
|
8
|
-
|
9
|
-
module Rack
|
10
|
-
module Session
|
11
|
-
# Rack::Session::Pool provides simple cookie based session management.
|
12
|
-
# Session data is stored in a hash held by @pool.
|
13
|
-
# In the context of a multithreaded environment, sessions being
|
14
|
-
# committed to the pool is done in a merging manner.
|
15
|
-
#
|
16
|
-
# The :drop option is available in rack.session.options if you with to
|
17
|
-
# explicitly remove the session from the session cache.
|
18
|
-
#
|
19
|
-
# Example:
|
20
|
-
# myapp = MyRackApp.new
|
21
|
-
# sessioned = Rack::Session::Pool.new(myapp,
|
22
|
-
# :domain => 'foo.com',
|
23
|
-
# :expire_after => 2592000
|
24
|
-
# )
|
25
|
-
# Rack::Handler::WEBrick.run sessioned
|
26
|
-
|
27
|
-
class Pool < Abstract::ID
|
28
|
-
attr_reader :mutex, :pool
|
29
|
-
DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge :drop => false
|
30
|
-
|
31
|
-
def initialize(app, options={})
|
32
|
-
super
|
33
|
-
@pool = Hash.new
|
34
|
-
@mutex = Mutex.new
|
35
|
-
end
|
36
|
-
|
37
|
-
def generate_sid
|
38
|
-
loop do
|
39
|
-
sid = super
|
40
|
-
break sid unless @pool.key? sid
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def get_session(env, sid)
|
45
|
-
session = @pool[sid] if sid
|
46
|
-
@mutex.lock if env['rack.multithread']
|
47
|
-
unless sid and session
|
48
|
-
env['rack.errors'].puts("Session '#{sid.inspect}' not found, initializing...") if $VERBOSE and not sid.nil?
|
49
|
-
session = {}
|
50
|
-
sid = generate_sid
|
51
|
-
@pool.store sid, session
|
52
|
-
end
|
53
|
-
session.instance_variable_set('@old', {}.merge(session))
|
54
|
-
return [sid, session]
|
55
|
-
ensure
|
56
|
-
@mutex.unlock if env['rack.multithread']
|
57
|
-
end
|
58
|
-
|
59
|
-
def set_session(env, session_id, new_session, options)
|
60
|
-
@mutex.lock if env['rack.multithread']
|
61
|
-
session = @pool[session_id]
|
62
|
-
if options[:renew] or options[:drop]
|
63
|
-
@pool.delete session_id
|
64
|
-
return false if options[:drop]
|
65
|
-
session_id = generate_sid
|
66
|
-
@pool.store session_id, 0
|
67
|
-
end
|
68
|
-
old_session = new_session.instance_variable_get('@old') || {}
|
69
|
-
session = merge_sessions session_id, old_session, new_session, session
|
70
|
-
@pool.store session_id, session
|
71
|
-
return session_id
|
72
|
-
rescue
|
73
|
-
warn "#{new_session.inspect} has been lost."
|
74
|
-
warn $!.inspect
|
75
|
-
ensure
|
76
|
-
@mutex.unlock if env['rack.multithread']
|
77
|
-
end
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
def merge_sessions sid, old, new, cur=nil
|
82
|
-
cur ||= {}
|
83
|
-
unless Hash === old and Hash === new
|
84
|
-
warn 'Bad old or new sessions provided.'
|
85
|
-
return cur
|
86
|
-
end
|
87
|
-
|
88
|
-
delete = old.keys - new.keys
|
89
|
-
warn "//@#{sid}: dropping #{delete*','}" if $DEBUG and not delete.empty?
|
90
|
-
delete.each{|k| cur.delete k }
|
91
|
-
|
92
|
-
update = new.keys.select{|k| new[k] != old[k] }
|
93
|
-
warn "//@#{sid}: updating #{update*','}" if $DEBUG and not update.empty?
|
94
|
-
update.each{|k| cur[k] = new[k] }
|
95
|
-
|
96
|
-
cur
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
@@ -1,349 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
require 'erb'
|
3
|
-
require 'rack/request'
|
4
|
-
require 'rack/utils'
|
5
|
-
|
6
|
-
module Rack
|
7
|
-
# Rack::ShowExceptions catches all exceptions raised from the app it
|
8
|
-
# wraps. It shows a useful backtrace with the sourcefile and
|
9
|
-
# clickable context, the whole Rack environment and the request
|
10
|
-
# data.
|
11
|
-
#
|
12
|
-
# Be careful when you use this on public-facing sites as it could
|
13
|
-
# reveal information helpful to attackers.
|
14
|
-
|
15
|
-
class ShowExceptions
|
16
|
-
CONTEXT = 7
|
17
|
-
|
18
|
-
def initialize(app)
|
19
|
-
@app = app
|
20
|
-
@template = ERB.new(TEMPLATE)
|
21
|
-
end
|
22
|
-
|
23
|
-
def call(env)
|
24
|
-
@app.call(env)
|
25
|
-
rescue StandardError, LoadError, SyntaxError => e
|
26
|
-
backtrace = pretty(env, e)
|
27
|
-
[500,
|
28
|
-
{"Content-Type" => "text/html",
|
29
|
-
"Content-Length" => backtrace.join.size.to_s},
|
30
|
-
backtrace]
|
31
|
-
end
|
32
|
-
|
33
|
-
def pretty(env, exception)
|
34
|
-
req = Rack::Request.new(env)
|
35
|
-
path = (req.script_name + req.path_info).squeeze("/")
|
36
|
-
|
37
|
-
frames = exception.backtrace.map { |line|
|
38
|
-
frame = OpenStruct.new
|
39
|
-
if line =~ /(.*?):(\d+)(:in `(.*)')?/
|
40
|
-
frame.filename = $1
|
41
|
-
frame.lineno = $2.to_i
|
42
|
-
frame.function = $4
|
43
|
-
|
44
|
-
begin
|
45
|
-
lineno = frame.lineno-1
|
46
|
-
lines = ::File.readlines(frame.filename)
|
47
|
-
frame.pre_context_lineno = [lineno-CONTEXT, 0].max
|
48
|
-
frame.pre_context = lines[frame.pre_context_lineno...lineno]
|
49
|
-
frame.context_line = lines[lineno].chomp
|
50
|
-
frame.post_context_lineno = [lineno+CONTEXT, lines.size].min
|
51
|
-
frame.post_context = lines[lineno+1..frame.post_context_lineno]
|
52
|
-
rescue
|
53
|
-
end
|
54
|
-
|
55
|
-
frame
|
56
|
-
else
|
57
|
-
nil
|
58
|
-
end
|
59
|
-
}.compact
|
60
|
-
|
61
|
-
env["rack.errors"].puts "#{exception.class}: #{exception.message}"
|
62
|
-
env["rack.errors"].puts exception.backtrace.map { |l| "\t" + l }
|
63
|
-
env["rack.errors"].flush
|
64
|
-
|
65
|
-
[@template.result(binding)]
|
66
|
-
end
|
67
|
-
|
68
|
-
def h(obj) # :nodoc:
|
69
|
-
case obj
|
70
|
-
when String
|
71
|
-
Utils.escape_html(obj)
|
72
|
-
else
|
73
|
-
Utils.escape_html(obj.inspect)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# :stopdoc:
|
78
|
-
|
79
|
-
# adapted from Django <djangoproject.com>
|
80
|
-
# Copyright (c) 2005, the Lawrence Journal-World
|
81
|
-
# Used under the modified BSD license:
|
82
|
-
# http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
|
83
|
-
TEMPLATE = <<'HTML'
|
84
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
85
|
-
<html lang="en">
|
86
|
-
<head>
|
87
|
-
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
88
|
-
<meta name="robots" content="NONE,NOARCHIVE" />
|
89
|
-
<title><%=h exception.class %> at <%=h path %></title>
|
90
|
-
<style type="text/css">
|
91
|
-
html * { padding:0; margin:0; }
|
92
|
-
body * { padding:10px 20px; }
|
93
|
-
body * * { padding:0; }
|
94
|
-
body { font:small sans-serif; }
|
95
|
-
body>div { border-bottom:1px solid #ddd; }
|
96
|
-
h1 { font-weight:normal; }
|
97
|
-
h2 { margin-bottom:.8em; }
|
98
|
-
h2 span { font-size:80%; color:#666; font-weight:normal; }
|
99
|
-
h3 { margin:1em 0 .5em 0; }
|
100
|
-
h4 { margin:0 0 .5em 0; font-weight: normal; }
|
101
|
-
table {
|
102
|
-
border:1px solid #ccc; border-collapse: collapse; background:white; }
|
103
|
-
tbody td, tbody th { vertical-align:top; padding:2px 3px; }
|
104
|
-
thead th {
|
105
|
-
padding:1px 6px 1px 3px; background:#fefefe; text-align:left;
|
106
|
-
font-weight:normal; font-size:11px; border:1px solid #ddd; }
|
107
|
-
tbody th { text-align:right; color:#666; padding-right:.5em; }
|
108
|
-
table.vars { margin:5px 0 2px 40px; }
|
109
|
-
table.vars td, table.req td { font-family:monospace; }
|
110
|
-
table td.code { width:100%;}
|
111
|
-
table td.code div { overflow:hidden; }
|
112
|
-
table.source th { color:#666; }
|
113
|
-
table.source td {
|
114
|
-
font-family:monospace; white-space:pre; border-bottom:1px solid #eee; }
|
115
|
-
ul.traceback { list-style-type:none; }
|
116
|
-
ul.traceback li.frame { margin-bottom:1em; }
|
117
|
-
div.context { margin: 10px 0; }
|
118
|
-
div.context ol {
|
119
|
-
padding-left:30px; margin:0 10px; list-style-position: inside; }
|
120
|
-
div.context ol li {
|
121
|
-
font-family:monospace; white-space:pre; color:#666; cursor:pointer; }
|
122
|
-
div.context ol.context-line li { color:black; background-color:#ccc; }
|
123
|
-
div.context ol.context-line li span { float: right; }
|
124
|
-
div.commands { margin-left: 40px; }
|
125
|
-
div.commands a { color:black; text-decoration:none; }
|
126
|
-
#summary { background: #ffc; }
|
127
|
-
#summary h2 { font-weight: normal; color: #666; }
|
128
|
-
#summary ul#quicklinks { list-style-type: none; margin-bottom: 2em; }
|
129
|
-
#summary ul#quicklinks li { float: left; padding: 0 1em; }
|
130
|
-
#summary ul#quicklinks>li+li { border-left: 1px #666 solid; }
|
131
|
-
#explanation { background:#eee; }
|
132
|
-
#template, #template-not-exist { background:#f6f6f6; }
|
133
|
-
#template-not-exist ul { margin: 0 0 0 20px; }
|
134
|
-
#traceback { background:#eee; }
|
135
|
-
#requestinfo { background:#f6f6f6; padding-left:120px; }
|
136
|
-
#summary table { border:none; background:transparent; }
|
137
|
-
#requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; }
|
138
|
-
#requestinfo h3 { margin-bottom:-1em; }
|
139
|
-
.error { background: #ffc; }
|
140
|
-
.specific { color:#cc3300; font-weight:bold; }
|
141
|
-
</style>
|
142
|
-
<script type="text/javascript">
|
143
|
-
//<!--
|
144
|
-
function getElementsByClassName(oElm, strTagName, strClassName){
|
145
|
-
// Written by Jonathan Snook, http://www.snook.ca/jon;
|
146
|
-
// Add-ons by Robert Nyman, http://www.robertnyman.com
|
147
|
-
var arrElements = (strTagName == "*" && document.all)? document.all :
|
148
|
-
oElm.getElementsByTagName(strTagName);
|
149
|
-
var arrReturnElements = new Array();
|
150
|
-
strClassName = strClassName.replace(/\-/g, "\\-");
|
151
|
-
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$$)");
|
152
|
-
var oElement;
|
153
|
-
for(var i=0; i<arrElements.length; i++){
|
154
|
-
oElement = arrElements[i];
|
155
|
-
if(oRegExp.test(oElement.className)){
|
156
|
-
arrReturnElements.push(oElement);
|
157
|
-
}
|
158
|
-
}
|
159
|
-
return (arrReturnElements)
|
160
|
-
}
|
161
|
-
function hideAll(elems) {
|
162
|
-
for (var e = 0; e < elems.length; e++) {
|
163
|
-
elems[e].style.display = 'none';
|
164
|
-
}
|
165
|
-
}
|
166
|
-
window.onload = function() {
|
167
|
-
hideAll(getElementsByClassName(document, 'table', 'vars'));
|
168
|
-
hideAll(getElementsByClassName(document, 'ol', 'pre-context'));
|
169
|
-
hideAll(getElementsByClassName(document, 'ol', 'post-context'));
|
170
|
-
}
|
171
|
-
function toggle() {
|
172
|
-
for (var i = 0; i < arguments.length; i++) {
|
173
|
-
var e = document.getElementById(arguments[i]);
|
174
|
-
if (e) {
|
175
|
-
e.style.display = e.style.display == 'none' ? 'block' : 'none';
|
176
|
-
}
|
177
|
-
}
|
178
|
-
return false;
|
179
|
-
}
|
180
|
-
function varToggle(link, id) {
|
181
|
-
toggle('v' + id);
|
182
|
-
var s = link.getElementsByTagName('span')[0];
|
183
|
-
var uarr = String.fromCharCode(0x25b6);
|
184
|
-
var darr = String.fromCharCode(0x25bc);
|
185
|
-
s.innerHTML = s.innerHTML == uarr ? darr : uarr;
|
186
|
-
return false;
|
187
|
-
}
|
188
|
-
//-->
|
189
|
-
</script>
|
190
|
-
</head>
|
191
|
-
<body>
|
192
|
-
|
193
|
-
<div id="summary">
|
194
|
-
<h1><%=h exception.class %> at <%=h path %></h1>
|
195
|
-
<h2><%=h exception.message %></h2>
|
196
|
-
<table><tr>
|
197
|
-
<th>Ruby</th>
|
198
|
-
<td><code><%=h frames.first.filename %></code>: in <code><%=h frames.first.function %></code>, line <%=h frames.first.lineno %></td>
|
199
|
-
</tr><tr>
|
200
|
-
<th>Web</th>
|
201
|
-
<td><code><%=h req.request_method %> <%=h(req.host + path)%></code></td>
|
202
|
-
</tr></table>
|
203
|
-
|
204
|
-
<h3>Jump to:</h3>
|
205
|
-
<ul id="quicklinks">
|
206
|
-
<li><a href="#get-info">GET</a></li>
|
207
|
-
<li><a href="#post-info">POST</a></li>
|
208
|
-
<li><a href="#cookie-info">Cookies</a></li>
|
209
|
-
<li><a href="#env-info">ENV</a></li>
|
210
|
-
</ul>
|
211
|
-
</div>
|
212
|
-
|
213
|
-
<div id="traceback">
|
214
|
-
<h2>Traceback <span>(innermost first)</span></h2>
|
215
|
-
<ul class="traceback">
|
216
|
-
<% frames.each { |frame| %>
|
217
|
-
<li class="frame">
|
218
|
-
<code><%=h frame.filename %></code>: in <code><%=h frame.function %></code>
|
219
|
-
|
220
|
-
<% if frame.context_line %>
|
221
|
-
<div class="context" id="c<%=h frame.object_id %>">
|
222
|
-
<% if frame.pre_context %>
|
223
|
-
<ol start="<%=h frame.pre_context_lineno+1 %>" class="pre-context" id="pre<%=h frame.object_id %>">
|
224
|
-
<% frame.pre_context.each { |line| %>
|
225
|
-
<li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h line %></li>
|
226
|
-
<% } %>
|
227
|
-
</ol>
|
228
|
-
<% end %>
|
229
|
-
|
230
|
-
<ol start="<%=h frame.lineno %>" class="context-line">
|
231
|
-
<li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h frame.context_line %><span>...</span></li></ol>
|
232
|
-
|
233
|
-
<% if frame.post_context %>
|
234
|
-
<ol start='<%=h frame.lineno+1 %>' class="post-context" id="post<%=h frame.object_id %>">
|
235
|
-
<% frame.post_context.each { |line| %>
|
236
|
-
<li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h line %></li>
|
237
|
-
<% } %>
|
238
|
-
</ol>
|
239
|
-
<% end %>
|
240
|
-
</div>
|
241
|
-
<% end %>
|
242
|
-
</li>
|
243
|
-
<% } %>
|
244
|
-
</ul>
|
245
|
-
</div>
|
246
|
-
|
247
|
-
<div id="requestinfo">
|
248
|
-
<h2>Request information</h2>
|
249
|
-
|
250
|
-
<h3 id="get-info">GET</h3>
|
251
|
-
<% unless req.GET.empty? %>
|
252
|
-
<table class="req">
|
253
|
-
<thead>
|
254
|
-
<tr>
|
255
|
-
<th>Variable</th>
|
256
|
-
<th>Value</th>
|
257
|
-
</tr>
|
258
|
-
</thead>
|
259
|
-
<tbody>
|
260
|
-
<% req.GET.sort_by { |k, v| k.to_s }.each { |key, val| %>
|
261
|
-
<tr>
|
262
|
-
<td><%=h key %></td>
|
263
|
-
<td class="code"><div><%=h val.inspect %></div></td>
|
264
|
-
</tr>
|
265
|
-
<% } %>
|
266
|
-
</tbody>
|
267
|
-
</table>
|
268
|
-
<% else %>
|
269
|
-
<p>No GET data.</p>
|
270
|
-
<% end %>
|
271
|
-
|
272
|
-
<h3 id="post-info">POST</h3>
|
273
|
-
<% unless req.POST.empty? %>
|
274
|
-
<table class="req">
|
275
|
-
<thead>
|
276
|
-
<tr>
|
277
|
-
<th>Variable</th>
|
278
|
-
<th>Value</th>
|
279
|
-
</tr>
|
280
|
-
</thead>
|
281
|
-
<tbody>
|
282
|
-
<% req.POST.sort_by { |k, v| k.to_s }.each { |key, val| %>
|
283
|
-
<tr>
|
284
|
-
<td><%=h key %></td>
|
285
|
-
<td class="code"><div><%=h val.inspect %></div></td>
|
286
|
-
</tr>
|
287
|
-
<% } %>
|
288
|
-
</tbody>
|
289
|
-
</table>
|
290
|
-
<% else %>
|
291
|
-
<p>No POST data.</p>
|
292
|
-
<% end %>
|
293
|
-
|
294
|
-
|
295
|
-
<h3 id="cookie-info">COOKIES</h3>
|
296
|
-
<% unless req.cookies.empty? %>
|
297
|
-
<table class="req">
|
298
|
-
<thead>
|
299
|
-
<tr>
|
300
|
-
<th>Variable</th>
|
301
|
-
<th>Value</th>
|
302
|
-
</tr>
|
303
|
-
</thead>
|
304
|
-
<tbody>
|
305
|
-
<% req.cookies.each { |key, val| %>
|
306
|
-
<tr>
|
307
|
-
<td><%=h key %></td>
|
308
|
-
<td class="code"><div><%=h val.inspect %></div></td>
|
309
|
-
</tr>
|
310
|
-
<% } %>
|
311
|
-
</tbody>
|
312
|
-
</table>
|
313
|
-
<% else %>
|
314
|
-
<p>No cookie data.</p>
|
315
|
-
<% end %>
|
316
|
-
|
317
|
-
<h3 id="env-info">Rack ENV</h3>
|
318
|
-
<table class="req">
|
319
|
-
<thead>
|
320
|
-
<tr>
|
321
|
-
<th>Variable</th>
|
322
|
-
<th>Value</th>
|
323
|
-
</tr>
|
324
|
-
</thead>
|
325
|
-
<tbody>
|
326
|
-
<% env.sort_by { |k, v| k.to_s }.each { |key, val| %>
|
327
|
-
<tr>
|
328
|
-
<td><%=h key %></td>
|
329
|
-
<td class="code"><div><%=h val %></div></td>
|
330
|
-
</tr>
|
331
|
-
<% } %>
|
332
|
-
</tbody>
|
333
|
-
</table>
|
334
|
-
|
335
|
-
</div>
|
336
|
-
|
337
|
-
<div id="explanation">
|
338
|
-
<p>
|
339
|
-
You're seeing this error because you use <code>Rack::ShowExceptions</code>.
|
340
|
-
</p>
|
341
|
-
</div>
|
342
|
-
|
343
|
-
</body>
|
344
|
-
</html>
|
345
|
-
HTML
|
346
|
-
|
347
|
-
# :startdoc:
|
348
|
-
end
|
349
|
-
end
|