rack 1.6.11 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack might be problematic. Click here for more details.

Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +675 -0
  3. data/CONTRIBUTING.md +136 -0
  4. data/{COPYING → MIT-LICENSE} +4 -2
  5. data/README.rdoc +157 -163
  6. data/Rakefile +38 -32
  7. data/{SPEC → SPEC.rdoc} +41 -13
  8. data/bin/rackup +1 -0
  9. data/contrib/rack_logo.svg +164 -111
  10. data/example/lobster.ru +2 -0
  11. data/example/protectedlobster.rb +4 -2
  12. data/example/protectedlobster.ru +3 -1
  13. data/lib/rack/auth/abstract/handler.rb +3 -1
  14. data/lib/rack/auth/abstract/request.rb +6 -2
  15. data/lib/rack/auth/basic.rb +7 -4
  16. data/lib/rack/auth/digest/md5.rb +13 -11
  17. data/lib/rack/auth/digest/nonce.rb +6 -3
  18. data/lib/rack/auth/digest/params.rb +5 -4
  19. data/lib/rack/auth/digest/request.rb +6 -4
  20. data/lib/rack/body_proxy.rb +21 -15
  21. data/lib/rack/builder.rb +119 -26
  22. data/lib/rack/cascade.rb +28 -12
  23. data/lib/rack/chunked.rb +70 -22
  24. data/lib/rack/common_logger.rb +80 -0
  25. data/lib/rack/{conditionalget.rb → conditional_get.rb} +20 -16
  26. data/lib/rack/config.rb +2 -0
  27. data/lib/rack/content_length.rb +9 -8
  28. data/lib/rack/content_type.rb +5 -4
  29. data/lib/rack/core_ext/regexp.rb +14 -0
  30. data/lib/rack/deflater.rb +60 -70
  31. data/lib/rack/directory.rb +117 -85
  32. data/lib/rack/etag.rb +9 -7
  33. data/lib/rack/events.rb +153 -0
  34. data/lib/rack/file.rb +4 -149
  35. data/lib/rack/files.rb +218 -0
  36. data/lib/rack/handler/cgi.rb +17 -19
  37. data/lib/rack/handler/fastcgi.rb +17 -18
  38. data/lib/rack/handler/lsws.rb +14 -14
  39. data/lib/rack/handler/scgi.rb +22 -21
  40. data/lib/rack/handler/thin.rb +20 -11
  41. data/lib/rack/handler/webrick.rb +39 -32
  42. data/lib/rack/handler.rb +9 -26
  43. data/lib/rack/head.rb +16 -18
  44. data/lib/rack/lint.rb +110 -64
  45. data/lib/rack/lobster.rb +10 -10
  46. data/lib/rack/lock.rb +17 -11
  47. data/lib/rack/logger.rb +4 -2
  48. data/lib/rack/media_type.rb +43 -0
  49. data/lib/rack/{methodoverride.rb → method_override.rb} +10 -8
  50. data/lib/rack/mime.rb +27 -6
  51. data/lib/rack/mock.rb +124 -65
  52. data/lib/rack/multipart/generator.rb +20 -16
  53. data/lib/rack/multipart/parser.rb +273 -162
  54. data/lib/rack/multipart/uploaded_file.rb +15 -8
  55. data/lib/rack/multipart.rb +39 -8
  56. data/lib/rack/{nulllogger.rb → null_logger.rb} +3 -1
  57. data/lib/rack/query_parser.rb +217 -0
  58. data/lib/rack/recursive.rb +11 -9
  59. data/lib/rack/reloader.rb +8 -4
  60. data/lib/rack/request.rb +543 -305
  61. data/lib/rack/response.rb +244 -88
  62. data/lib/rack/rewindable_input.rb +5 -15
  63. data/lib/rack/runtime.rb +12 -18
  64. data/lib/rack/sendfile.rb +17 -15
  65. data/lib/rack/server.rb +125 -47
  66. data/lib/rack/session/abstract/id.rb +216 -93
  67. data/lib/rack/session/cookie.rb +47 -31
  68. data/lib/rack/session/memcache.rb +4 -87
  69. data/lib/rack/session/pool.rb +26 -17
  70. data/lib/rack/show_exceptions.rb +390 -0
  71. data/lib/rack/{showstatus.rb → show_status.rb} +8 -8
  72. data/lib/rack/static.rb +48 -11
  73. data/lib/rack/tempfile_reaper.rb +3 -3
  74. data/lib/rack/urlmap.rb +26 -19
  75. data/lib/rack/utils.rb +208 -294
  76. data/lib/rack/version.rb +29 -0
  77. data/lib/rack.rb +76 -33
  78. data/rack.gemspec +43 -30
  79. metadata +62 -183
  80. data/HISTORY.md +0 -375
  81. data/KNOWN-ISSUES +0 -44
  82. data/lib/rack/backports/uri/common_18.rb +0 -56
  83. data/lib/rack/backports/uri/common_192.rb +0 -52
  84. data/lib/rack/backports/uri/common_193.rb +0 -29
  85. data/lib/rack/commonlogger.rb +0 -72
  86. data/lib/rack/handler/evented_mongrel.rb +0 -8
  87. data/lib/rack/handler/mongrel.rb +0 -106
  88. data/lib/rack/handler/swiftiplied_mongrel.rb +0 -8
  89. data/lib/rack/showexceptions.rb +0 -387
  90. data/lib/rack/utils/okjson.rb +0 -600
  91. data/test/builder/anything.rb +0 -5
  92. data/test/builder/comment.ru +0 -4
  93. data/test/builder/end.ru +0 -5
  94. data/test/builder/line.ru +0 -1
  95. data/test/builder/options.ru +0 -2
  96. data/test/cgi/assets/folder/test.js +0 -1
  97. data/test/cgi/assets/fonts/font.eot +0 -1
  98. data/test/cgi/assets/images/image.png +0 -1
  99. data/test/cgi/assets/index.html +0 -1
  100. data/test/cgi/assets/javascripts/app.js +0 -1
  101. data/test/cgi/assets/stylesheets/app.css +0 -1
  102. data/test/cgi/lighttpd.conf +0 -26
  103. data/test/cgi/rackup_stub.rb +0 -6
  104. data/test/cgi/sample_rackup.ru +0 -5
  105. data/test/cgi/test +0 -9
  106. data/test/cgi/test+directory/test+file +0 -1
  107. data/test/cgi/test.fcgi +0 -8
  108. data/test/cgi/test.ru +0 -5
  109. data/test/gemloader.rb +0 -10
  110. data/test/multipart/bad_robots +0 -259
  111. data/test/multipart/binary +0 -0
  112. data/test/multipart/content_type_and_no_filename +0 -6
  113. data/test/multipart/empty +0 -10
  114. data/test/multipart/fail_16384_nofile +0 -814
  115. data/test/multipart/file1.txt +0 -1
  116. data/test/multipart/filename_and_modification_param +0 -7
  117. data/test/multipart/filename_and_no_name +0 -6
  118. data/test/multipart/filename_with_escaped_quotes +0 -6
  119. data/test/multipart/filename_with_escaped_quotes_and_modification_param +0 -7
  120. data/test/multipart/filename_with_null_byte +0 -7
  121. data/test/multipart/filename_with_percent_escaped_quotes +0 -6
  122. data/test/multipart/filename_with_unescaped_percentages +0 -6
  123. data/test/multipart/filename_with_unescaped_percentages2 +0 -6
  124. data/test/multipart/filename_with_unescaped_percentages3 +0 -6
  125. data/test/multipart/filename_with_unescaped_quotes +0 -6
  126. data/test/multipart/ie +0 -6
  127. data/test/multipart/invalid_character +0 -6
  128. data/test/multipart/mixed_files +0 -21
  129. data/test/multipart/nested +0 -10
  130. data/test/multipart/none +0 -9
  131. data/test/multipart/semicolon +0 -6
  132. data/test/multipart/text +0 -15
  133. data/test/multipart/three_files_three_fields +0 -31
  134. data/test/multipart/webkit +0 -32
  135. data/test/rackup/config.ru +0 -31
  136. data/test/registering_handler/rack/handler/registering_myself.rb +0 -8
  137. data/test/spec_auth_basic.rb +0 -81
  138. data/test/spec_auth_digest.rb +0 -259
  139. data/test/spec_body_proxy.rb +0 -85
  140. data/test/spec_builder.rb +0 -223
  141. data/test/spec_cascade.rb +0 -61
  142. data/test/spec_cgi.rb +0 -102
  143. data/test/spec_chunked.rb +0 -101
  144. data/test/spec_commonlogger.rb +0 -93
  145. data/test/spec_conditionalget.rb +0 -102
  146. data/test/spec_config.rb +0 -22
  147. data/test/spec_content_length.rb +0 -85
  148. data/test/spec_content_type.rb +0 -45
  149. data/test/spec_deflater.rb +0 -339
  150. data/test/spec_directory.rb +0 -88
  151. data/test/spec_etag.rb +0 -107
  152. data/test/spec_fastcgi.rb +0 -107
  153. data/test/spec_file.rb +0 -221
  154. data/test/spec_handler.rb +0 -72
  155. data/test/spec_head.rb +0 -45
  156. data/test/spec_lint.rb +0 -550
  157. data/test/spec_lobster.rb +0 -58
  158. data/test/spec_lock.rb +0 -164
  159. data/test/spec_logger.rb +0 -23
  160. data/test/spec_methodoverride.rb +0 -111
  161. data/test/spec_mime.rb +0 -51
  162. data/test/spec_mock.rb +0 -297
  163. data/test/spec_mongrel.rb +0 -182
  164. data/test/spec_multipart.rb +0 -600
  165. data/test/spec_nulllogger.rb +0 -20
  166. data/test/spec_recursive.rb +0 -72
  167. data/test/spec_request.rb +0 -1232
  168. data/test/spec_response.rb +0 -407
  169. data/test/spec_rewindable_input.rb +0 -118
  170. data/test/spec_runtime.rb +0 -49
  171. data/test/spec_sendfile.rb +0 -130
  172. data/test/spec_server.rb +0 -167
  173. data/test/spec_session_abstract_id.rb +0 -53
  174. data/test/spec_session_cookie.rb +0 -410
  175. data/test/spec_session_memcache.rb +0 -321
  176. data/test/spec_session_pool.rb +0 -209
  177. data/test/spec_showexceptions.rb +0 -98
  178. data/test/spec_showstatus.rb +0 -103
  179. data/test/spec_static.rb +0 -145
  180. data/test/spec_tempfile_reaper.rb +0 -63
  181. data/test/spec_thin.rb +0 -91
  182. data/test/spec_urlmap.rb +0 -236
  183. data/test/spec_utils.rb +0 -647
  184. data/test/spec_version.rb +0 -17
  185. data/test/spec_webrick.rb +0 -184
  186. data/test/static/another/index.html +0 -1
  187. data/test/static/index.html +0 -1
  188. data/test/testrequest.rb +0 -78
  189. data/test/unregistered_handler/rack/handler/unregistered.rb +0 -7
  190. data/test/unregistered_handler/rack/handler/unregistered_long_one.rb +0 -7
@@ -1,106 +0,0 @@
1
- require 'mongrel'
2
- require 'stringio'
3
- require 'rack/content_length'
4
- require 'rack/chunked'
5
-
6
- module Rack
7
- module Handler
8
- class Mongrel < ::Mongrel::HttpHandler
9
- def self.run(app, options={})
10
- environment = ENV['RACK_ENV'] || 'development'
11
- default_host = environment == 'development' ? 'localhost' : '0.0.0.0'
12
-
13
- server = ::Mongrel::HttpServer.new(
14
- options[:Host] || default_host,
15
- options[:Port] || 8080,
16
- options[:num_processors] || 950,
17
- options[:throttle] || 0,
18
- options[:timeout] || 60)
19
- # Acts like Rack::URLMap, utilizing Mongrel's own path finding methods.
20
- # Use is similar to #run, replacing the app argument with a hash of
21
- # { path=>app, ... } or an instance of Rack::URLMap.
22
- if options[:map]
23
- if app.is_a? Hash
24
- app.each do |path, appl|
25
- path = '/'+path unless path[0] == ?/
26
- server.register(path, Rack::Handler::Mongrel.new(appl))
27
- end
28
- elsif app.is_a? URLMap
29
- app.instance_variable_get(:@mapping).each do |(host, path, appl)|
30
- next if !host.nil? && !options[:Host].nil? && options[:Host] != host
31
- path = '/'+path unless path[0] == ?/
32
- server.register(path, Rack::Handler::Mongrel.new(appl))
33
- end
34
- else
35
- raise ArgumentError, "first argument should be a Hash or URLMap"
36
- end
37
- else
38
- server.register('/', Rack::Handler::Mongrel.new(app))
39
- end
40
- yield server if block_given?
41
- server.run.join
42
- end
43
-
44
- def self.valid_options
45
- environment = ENV['RACK_ENV'] || 'development'
46
- default_host = environment == 'development' ? 'localhost' : '0.0.0.0'
47
-
48
- {
49
- "Host=HOST" => "Hostname to listen on (default: #{default_host})",
50
- "Port=PORT" => "Port to listen on (default: 8080)",
51
- "Processors=N" => "Number of concurrent processors to accept (default: 950)",
52
- "Timeout=N" => "Time before a request is dropped for inactivity (default: 60)",
53
- "Throttle=N" => "Throttle time between socket.accept calls in hundredths of a second (default: 0)",
54
- }
55
- end
56
-
57
- def initialize(app)
58
- @app = app
59
- end
60
-
61
- def process(request, response)
62
- env = Hash[request.params]
63
- env.delete "HTTP_CONTENT_TYPE"
64
- env.delete "HTTP_CONTENT_LENGTH"
65
-
66
- env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
67
-
68
- rack_input = request.body || StringIO.new('')
69
- rack_input.set_encoding(Encoding::BINARY) if rack_input.respond_to?(:set_encoding)
70
-
71
- env.update({"rack.version" => Rack::VERSION,
72
- "rack.input" => rack_input,
73
- "rack.errors" => $stderr,
74
-
75
- "rack.multithread" => true,
76
- "rack.multiprocess" => false, # ???
77
- "rack.run_once" => false,
78
-
79
- "rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
80
- })
81
- env[QUERY_STRING] ||= ""
82
-
83
- status, headers, body = @app.call(env)
84
-
85
- begin
86
- response.status = status.to_i
87
- response.send_status(nil)
88
-
89
- headers.each { |k, vs|
90
- vs.split("\n").each { |v|
91
- response.header[k] = v
92
- }
93
- }
94
- response.send_header
95
-
96
- body.each { |part|
97
- response.write part
98
- response.socket.flush
99
- }
100
- ensure
101
- body.close if body.respond_to? :close
102
- end
103
- end
104
- end
105
- end
106
- end
@@ -1,8 +0,0 @@
1
- require 'swiftcore/swiftiplied_mongrel'
2
-
3
- module Rack
4
- module Handler
5
- class SwiftipliedMongrel < Handler::Mongrel
6
- end
7
- end
8
- end
@@ -1,387 +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
- exception_string = dump_exception(e)
27
-
28
- env["rack.errors"].puts(exception_string)
29
- env["rack.errors"].flush
30
-
31
- if accepts_html?(env)
32
- content_type = "text/html"
33
- body = pretty(env, e)
34
- else
35
- content_type = "text/plain"
36
- body = exception_string
37
- end
38
-
39
- [
40
- 500,
41
- {
42
- CONTENT_TYPE => content_type,
43
- CONTENT_LENGTH => Rack::Utils.bytesize(body).to_s,
44
- },
45
- [body],
46
- ]
47
- end
48
-
49
- def prefers_plaintext?(env)
50
- !accepts_html?(env)
51
- end
52
-
53
- def accepts_html?(env)
54
- Rack::Utils.best_q_match(env["HTTP_ACCEPT"], %w[text/html])
55
- end
56
- private :accepts_html?
57
-
58
- def dump_exception(exception)
59
- string = "#{exception.class}: #{exception.message}\n"
60
- string << exception.backtrace.map { |l| "\t#{l}" }.join("\n")
61
- string
62
- end
63
-
64
- def pretty(env, exception)
65
- req = Rack::Request.new(env)
66
-
67
- # This double assignment is to prevent an "unused variable" warning on
68
- # Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
69
- path = path = (req.script_name + req.path_info).squeeze("/")
70
-
71
- # This double assignment is to prevent an "unused variable" warning on
72
- # Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
73
- frames = frames = exception.backtrace.map { |line|
74
- frame = OpenStruct.new
75
- if line =~ /(.*?):(\d+)(:in `(.*)')?/
76
- frame.filename = $1
77
- frame.lineno = $2.to_i
78
- frame.function = $4
79
-
80
- begin
81
- lineno = frame.lineno-1
82
- lines = ::File.readlines(frame.filename)
83
- frame.pre_context_lineno = [lineno-CONTEXT, 0].max
84
- frame.pre_context = lines[frame.pre_context_lineno...lineno]
85
- frame.context_line = lines[lineno].chomp
86
- frame.post_context_lineno = [lineno+CONTEXT, lines.size].min
87
- frame.post_context = lines[lineno+1..frame.post_context_lineno]
88
- rescue
89
- end
90
-
91
- frame
92
- else
93
- nil
94
- end
95
- }.compact
96
-
97
- @template.result(binding)
98
- end
99
-
100
- def h(obj) # :nodoc:
101
- case obj
102
- when String
103
- Utils.escape_html(obj)
104
- else
105
- Utils.escape_html(obj.inspect)
106
- end
107
- end
108
-
109
- # :stopdoc:
110
-
111
- # adapted from Django <djangoproject.com>
112
- # Copyright (c) 2005, the Lawrence Journal-World
113
- # Used under the modified BSD license:
114
- # http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
115
- TEMPLATE = <<'HTML'
116
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
117
- <html lang="en">
118
- <head>
119
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
120
- <meta name="robots" content="NONE,NOARCHIVE" />
121
- <title><%=h exception.class %> at <%=h path %></title>
122
- <style type="text/css">
123
- html * { padding:0; margin:0; }
124
- body * { padding:10px 20px; }
125
- body * * { padding:0; }
126
- body { font:small sans-serif; }
127
- body>div { border-bottom:1px solid #ddd; }
128
- h1 { font-weight:normal; }
129
- h2 { margin-bottom:.8em; }
130
- h2 span { font-size:80%; color:#666; font-weight:normal; }
131
- h3 { margin:1em 0 .5em 0; }
132
- h4 { margin:0 0 .5em 0; font-weight: normal; }
133
- table {
134
- border:1px solid #ccc; border-collapse: collapse; background:white; }
135
- tbody td, tbody th { vertical-align:top; padding:2px 3px; }
136
- thead th {
137
- padding:1px 6px 1px 3px; background:#fefefe; text-align:left;
138
- font-weight:normal; font-size:11px; border:1px solid #ddd; }
139
- tbody th { text-align:right; color:#666; padding-right:.5em; }
140
- table.vars { margin:5px 0 2px 40px; }
141
- table.vars td, table.req td { font-family:monospace; }
142
- table td.code { width:100%;}
143
- table td.code div { overflow:hidden; }
144
- table.source th { color:#666; }
145
- table.source td {
146
- font-family:monospace; white-space:pre; border-bottom:1px solid #eee; }
147
- ul.traceback { list-style-type:none; }
148
- ul.traceback li.frame { margin-bottom:1em; }
149
- div.context { margin: 10px 0; }
150
- div.context ol {
151
- padding-left:30px; margin:0 10px; list-style-position: inside; }
152
- div.context ol li {
153
- font-family:monospace; white-space:pre; color:#666; cursor:pointer; }
154
- div.context ol.context-line li { color:black; background-color:#ccc; }
155
- div.context ol.context-line li span { float: right; }
156
- div.commands { margin-left: 40px; }
157
- div.commands a { color:black; text-decoration:none; }
158
- #summary { background: #ffc; }
159
- #summary h2 { font-weight: normal; color: #666; }
160
- #summary ul#quicklinks { list-style-type: none; margin-bottom: 2em; }
161
- #summary ul#quicklinks li { float: left; padding: 0 1em; }
162
- #summary ul#quicklinks>li+li { border-left: 1px #666 solid; }
163
- #explanation { background:#eee; }
164
- #template, #template-not-exist { background:#f6f6f6; }
165
- #template-not-exist ul { margin: 0 0 0 20px; }
166
- #traceback { background:#eee; }
167
- #requestinfo { background:#f6f6f6; padding-left:120px; }
168
- #summary table { border:none; background:transparent; }
169
- #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; }
170
- #requestinfo h3 { margin-bottom:-1em; }
171
- .error { background: #ffc; }
172
- .specific { color:#cc3300; font-weight:bold; }
173
- </style>
174
- <script type="text/javascript">
175
- //<!--
176
- function getElementsByClassName(oElm, strTagName, strClassName){
177
- // Written by Jonathan Snook, http://www.snook.ca/jon;
178
- // Add-ons by Robert Nyman, http://www.robertnyman.com
179
- var arrElements = (strTagName == "*" && document.all)? document.all :
180
- oElm.getElementsByTagName(strTagName);
181
- var arrReturnElements = new Array();
182
- strClassName = strClassName.replace(/\-/g, "\\-");
183
- var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$$)");
184
- var oElement;
185
- for(var i=0; i<arrElements.length; i++){
186
- oElement = arrElements[i];
187
- if(oRegExp.test(oElement.className)){
188
- arrReturnElements.push(oElement);
189
- }
190
- }
191
- return (arrReturnElements)
192
- }
193
- function hideAll(elems) {
194
- for (var e = 0; e < elems.length; e++) {
195
- elems[e].style.display = 'none';
196
- }
197
- }
198
- window.onload = function() {
199
- hideAll(getElementsByClassName(document, 'table', 'vars'));
200
- hideAll(getElementsByClassName(document, 'ol', 'pre-context'));
201
- hideAll(getElementsByClassName(document, 'ol', 'post-context'));
202
- }
203
- function toggle() {
204
- for (var i = 0; i < arguments.length; i++) {
205
- var e = document.getElementById(arguments[i]);
206
- if (e) {
207
- e.style.display = e.style.display == 'none' ? 'block' : 'none';
208
- }
209
- }
210
- return false;
211
- }
212
- function varToggle(link, id) {
213
- toggle('v' + id);
214
- var s = link.getElementsByTagName('span')[0];
215
- var uarr = String.fromCharCode(0x25b6);
216
- var darr = String.fromCharCode(0x25bc);
217
- s.innerHTML = s.innerHTML == uarr ? darr : uarr;
218
- return false;
219
- }
220
- //-->
221
- </script>
222
- </head>
223
- <body>
224
-
225
- <div id="summary">
226
- <h1><%=h exception.class %> at <%=h path %></h1>
227
- <h2><%=h exception.message %></h2>
228
- <table><tr>
229
- <th>Ruby</th>
230
- <td>
231
- <% if first = frames.first %>
232
- <code><%=h first.filename %></code>: in <code><%=h first.function %></code>, line <%=h frames.first.lineno %>
233
- <% else %>
234
- unknown location
235
- <% end %>
236
- </td>
237
- </tr><tr>
238
- <th>Web</th>
239
- <td><code><%=h req.request_method %> <%=h(req.host + path)%></code></td>
240
- </tr></table>
241
-
242
- <h3>Jump to:</h3>
243
- <ul id="quicklinks">
244
- <li><a href="#get-info">GET</a></li>
245
- <li><a href="#post-info">POST</a></li>
246
- <li><a href="#cookie-info">Cookies</a></li>
247
- <li><a href="#env-info">ENV</a></li>
248
- </ul>
249
- </div>
250
-
251
- <div id="traceback">
252
- <h2>Traceback <span>(innermost first)</span></h2>
253
- <ul class="traceback">
254
- <% frames.each { |frame| %>
255
- <li class="frame">
256
- <code><%=h frame.filename %></code>: in <code><%=h frame.function %></code>
257
-
258
- <% if frame.context_line %>
259
- <div class="context" id="c<%=h frame.object_id %>">
260
- <% if frame.pre_context %>
261
- <ol start="<%=h frame.pre_context_lineno+1 %>" class="pre-context" id="pre<%=h frame.object_id %>">
262
- <% frame.pre_context.each { |line| %>
263
- <li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h line %></li>
264
- <% } %>
265
- </ol>
266
- <% end %>
267
-
268
- <ol start="<%=h frame.lineno %>" class="context-line">
269
- <li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h frame.context_line %><span>...</span></li></ol>
270
-
271
- <% if frame.post_context %>
272
- <ol start='<%=h frame.lineno+1 %>' class="post-context" id="post<%=h frame.object_id %>">
273
- <% frame.post_context.each { |line| %>
274
- <li onclick="toggle('pre<%=h frame.object_id %>', 'post<%=h frame.object_id %>')"><%=h line %></li>
275
- <% } %>
276
- </ol>
277
- <% end %>
278
- </div>
279
- <% end %>
280
- </li>
281
- <% } %>
282
- </ul>
283
- </div>
284
-
285
- <div id="requestinfo">
286
- <h2>Request information</h2>
287
-
288
- <h3 id="get-info">GET</h3>
289
- <% if req.GET and not req.GET.empty? %>
290
- <table class="req">
291
- <thead>
292
- <tr>
293
- <th>Variable</th>
294
- <th>Value</th>
295
- </tr>
296
- </thead>
297
- <tbody>
298
- <% req.GET.sort_by { |k, v| k.to_s }.each { |key, val| %>
299
- <tr>
300
- <td><%=h key %></td>
301
- <td class="code"><div><%=h val.inspect %></div></td>
302
- </tr>
303
- <% } %>
304
- </tbody>
305
- </table>
306
- <% else %>
307
- <p>No GET data.</p>
308
- <% end %>
309
-
310
- <h3 id="post-info">POST</h3>
311
- <% if req.POST and not req.POST.empty? %>
312
- <table class="req">
313
- <thead>
314
- <tr>
315
- <th>Variable</th>
316
- <th>Value</th>
317
- </tr>
318
- </thead>
319
- <tbody>
320
- <% req.POST.sort_by { |k, v| k.to_s }.each { |key, val| %>
321
- <tr>
322
- <td><%=h key %></td>
323
- <td class="code"><div><%=h val.inspect %></div></td>
324
- </tr>
325
- <% } %>
326
- </tbody>
327
- </table>
328
- <% else %>
329
- <p>No POST data.</p>
330
- <% end %>
331
-
332
-
333
- <h3 id="cookie-info">COOKIES</h3>
334
- <% unless req.cookies.empty? %>
335
- <table class="req">
336
- <thead>
337
- <tr>
338
- <th>Variable</th>
339
- <th>Value</th>
340
- </tr>
341
- </thead>
342
- <tbody>
343
- <% req.cookies.each { |key, val| %>
344
- <tr>
345
- <td><%=h key %></td>
346
- <td class="code"><div><%=h val.inspect %></div></td>
347
- </tr>
348
- <% } %>
349
- </tbody>
350
- </table>
351
- <% else %>
352
- <p>No cookie data.</p>
353
- <% end %>
354
-
355
- <h3 id="env-info">Rack ENV</h3>
356
- <table class="req">
357
- <thead>
358
- <tr>
359
- <th>Variable</th>
360
- <th>Value</th>
361
- </tr>
362
- </thead>
363
- <tbody>
364
- <% env.sort_by { |k, v| k.to_s }.each { |key, val| %>
365
- <tr>
366
- <td><%=h key %></td>
367
- <td class="code"><div><%=h val %></div></td>
368
- </tr>
369
- <% } %>
370
- </tbody>
371
- </table>
372
-
373
- </div>
374
-
375
- <div id="explanation">
376
- <p>
377
- You're seeing this error because you use <code>Rack::ShowExceptions</code>.
378
- </p>
379
- </div>
380
-
381
- </body>
382
- </html>
383
- HTML
384
-
385
- # :startdoc:
386
- end
387
- end