web-console 3.6.1 → 3.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d439be9277cff602e612a47dd3186aaa0ab3800040f978d2ca68d3dd330b8379
4
- data.tar.gz: bdf788f4b48c2a615235a180db5b5b3b9d3a8d0d20326c5ed4157875a04503c5
3
+ metadata.gz: f09465d00b163545199aecc34e9f36d967cbfbeede260077e185a535a90c0640
4
+ data.tar.gz: 84b14845dd1dcce1fcbb644d64a5b3aca5532c8fae0a8b6062d73bce5c5cb7af
5
5
  SHA512:
6
- metadata.gz: 3ae6bec4c77114a1930b367211b2b093b3378e7618f59c27dfa88fb6824179e68c13d4d57a8bf54e92eb4587e7e77b0fe5b625d83623f57a55dbac2066c988d3
7
- data.tar.gz: e9282ecc93234e6dc296d65583d8028b3274a87ac83d46e8d4c429f06b965e5ba0de39ea4fc1355be0c0a616a99ca97dcbaf7e5f2c27cbd490be24467ab01fdf
6
+ metadata.gz: f746e8ce11d5da555297a72a3015bbe73d5f5e2133162fbee9da4e42127f3dd8aced4f80f5f1decfd20e14266a999b626a29d94e213fc114b8735dbd66e15de2
7
+ data.tar.gz: 2060ce124965f5daee3a3f46f3827842bd3efd3996a71a16a82071b0c85b064051619ba69c1f916c7b70d657b29cd94c2e00ce9253ba32da367f98f0bd57e811
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 3.6.2
6
+
7
+ * [#255](https://github.com/rails/web-console/pull/255) Fix the truncated HTML body, because of wrong Content-Length header ([@timomeh])
8
+
5
9
  ## 3.6.1
6
10
 
7
11
  * [#252](https://github.com/rails/web-console/pull/252) Fix improper injection in Rack bodies like ActionDispatch::Response::RackBody ([@gsamokovarov])
@@ -126,3 +130,4 @@ go to 3.1.0 instead.
126
130
  [@pat]: https://github.com/pat
127
131
  [@ybart]: https://github.com/ybart
128
132
  [@fl0l0u]: https://github.com/fl0l0u
133
+ [@timomeh]: https://github.com/timomeh
@@ -3,19 +3,28 @@
3
3
  module WebConsole
4
4
  # Injects content into a Rack body.
5
5
  class Injector
6
- def initialize(body)
6
+ def initialize(body, headers)
7
7
  @body = "".dup
8
8
 
9
9
  body.each { |part| @body << part }
10
10
  body.close if body.respond_to?(:close)
11
+
12
+ @headers = headers
11
13
  end
12
14
 
13
15
  def inject(content)
14
- if position = @body.rindex("</body>")
15
- [ @body.insert(position, content) ]
16
- else
17
- [ @body << content ]
18
- end
16
+ # Remove any previously set Content-Length header because we modify
17
+ # the body. Otherwise the response will be truncated.
18
+ @headers.delete("Content-Length")
19
+
20
+ [
21
+ if position = @body.rindex("</body>")
22
+ [ @body.insert(position, content) ]
23
+ else
24
+ [ @body << content ]
25
+ end,
26
+ @headers
27
+ ]
19
28
  end
20
29
  end
21
30
  end
@@ -34,7 +34,7 @@ module WebConsole
34
34
  headers["X-Web-Console-Mount-Point"] = mount_point
35
35
 
36
36
  template = Template.new(env, session)
37
- body = Injector.new(body).inject(template.render("index"))
37
+ body, headers = Injector.new(body, headers).inject(template.render("index"))
38
38
  end
39
39
 
40
40
  [ status, headers, body ]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebConsole
4
- VERSION = "3.6.1"
4
+ VERSION = "3.6.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.1
4
+ version: 3.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Somerville
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-04-19 00:00:00.000000000 Z
14
+ date: 2018-04-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: railties