bacchus 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- [status, headers.merge('Content-Length' => body.first.size.to_s), body]
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.length.to_s}, [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)
@@ -1,3 +1,3 @@
1
1
  module Bacchus
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bacchus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: