bacchus 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bacchus/rack/beta_site.rb +5 -3
- data/lib/bacchus/version.rb +1 -1
- metadata +1 -1
@@ -1,7 +1,8 @@
|
|
1
|
-
require 'rack/request'
|
2
1
|
module Rack
|
3
2
|
class BetaSite
|
4
3
|
|
4
|
+
include Rack::Utils
|
5
|
+
|
5
6
|
class Request < Rack::Request
|
6
7
|
def path=(new_path)
|
7
8
|
@new_path = new_path
|
@@ -49,7 +50,8 @@ module Rack
|
|
49
50
|
<script src="#{path_to('bacchus.js')}" type="text/javascript"></script>
|
50
51
|
EOS
|
51
52
|
body.first.gsub!(/(<\/body>)/i, "\\1\n" + script) or raise "Rack::BetaSite error: No closing </body> tag detected."
|
52
|
-
|
53
|
+
length = body.to_ary.inject(0) { |len, part| len + bytesize(part) }
|
54
|
+
[status, headers.merge('Content-Length' => length.to_s), body]
|
53
55
|
end
|
54
56
|
|
55
57
|
########################################################
|
@@ -62,7 +64,7 @@ module Rack
|
|
62
64
|
|
63
65
|
def render_locked
|
64
66
|
msg = "Site is locked"
|
65
|
-
[500, {'Content-Type' => 'text/html', 'Content-Length' => msg.
|
67
|
+
[500, {'Content-Type' => 'text/html', 'Content-Length' => bytesize(msg).to_s}, [msg]]
|
66
68
|
end
|
67
69
|
|
68
70
|
def access_denied?(request)
|
data/lib/bacchus/version.rb
CHANGED