falcon 0.17.4 → 0.17.5

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: bffdd8ea496ec7bdcac74b8c2c540f4d6da008d35d3d8f598764a2d17974b842
4
- data.tar.gz: 4f993d6d77cebb76ca53141f2e92febba54d3db3eeddaeda130d5bce04d9f48c
3
+ metadata.gz: 5236b4f598c705ca3edc34fde0642c631db40667e3eff10f86421803282e4e0f
4
+ data.tar.gz: 0b368e6e54a9ca811d29a514c007d653140f9f0a6440c7f71be17729a66dec7d
5
5
  SHA512:
6
- metadata.gz: 8c44c95675ce2e672a97048ca99070b83d773b7a840699f474b72744fe80f17fd8ba8a8d2061a0ab2659dc7622188b5238395b34871db2f17b424580ce0aa7e1
7
- data.tar.gz: 752f925c54ff738d48cbc2cd81104bd2291d931a5cfe5f1b3893c18e98a599d4bf32f5b0f8e9a5b6db5f9a456357cd1ad88053d5169acc470fff7a1313381607
6
+ metadata.gz: 703c41487454bec117de57d6bdf30f8492133ac1b8d589d430fcffb8d436e075f97f5749d5acb50179aad3a104292d54fc963c58c5b0c2b973634435804ed154
7
+ data.tar.gz: 9c0be50a44d5f9bc19a99cbf8aadb5a61324b30195ed3ada6f096e13e25513a5c3a64b6fc213ec51639da5b793a92d1265a9b8de705778614e98f363c286af31
data/README.md CHANGED
@@ -36,6 +36,10 @@ Falcon supports `rack.hijack` for HTTP/1.x connections. You can thus use [async-
36
36
 
37
37
  [async-websocket]: https://github.com/socketry/async-websocket
38
38
 
39
+ #### ActionCable
40
+
41
+ The `rack.hijack` functionality is compatible with ActionCable. If you use the `async` adapter, you should run falcon in threaded mode, or in forked mode with `--concurrency 1`. Otherwise, your messaging system will be distributed over several processes with no IPC mechanism.
42
+
39
43
  ### Integration with Guard
40
44
 
41
45
  Falcon can restart very quickly and is ideal for use with guard. See [guard-falcon] for more details.
@@ -27,20 +27,23 @@ module Falcon
27
27
  CONTENT_LENGTH = 'content-length'.freeze
28
28
 
29
29
  # Wraps an array into a buffered body.
30
- def self.wrap(headers, body)
30
+ def self.wrap(status, headers, body)
31
+ # In no circumstance do we want this propagating up:
32
+ content_length = headers.delete(CONTENT_LENGTH)
33
+
31
34
  if body.is_a?(Async::HTTP::Body::Readable)
32
35
  return body
33
- # This needs more testing:
34
- elsif body.respond_to?(:to_path)
36
+ elsif status == 200 and body.respond_to?(:to_path)
37
+ # Don't mangle partial responsese (206)
35
38
  return Async::HTTP::Body::File.open(body.to_path)
36
39
  else
37
- return self.new(headers, body)
40
+ return self.new(headers, body, (Integer(content_length) rescue nil))
38
41
  end
39
42
  end
40
43
 
41
- def initialize(headers, body)
44
+ def initialize(headers, body, length)
42
45
  # We don't trust the user to provide the right length to the transport.
43
- @length = headers.delete(CONTENT_LENGTH)
46
+ @length = length
44
47
 
45
48
  @body = body
46
49
  @chunks = body.to_enum(:each)
@@ -27,7 +27,7 @@ module Falcon
27
27
  # We normalize headers to be lower case:
28
28
  headers = headers.map{|key, value| [key.downcase, value]}.to_h
29
29
 
30
- super(nil, status, nil, headers, Output.wrap(headers, body))
30
+ super(nil, status, nil, headers, Output.wrap(status, headers, body))
31
31
  end
32
32
  end
33
33
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.17.4"
22
+ VERSION = "0.17.5"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.4
4
+ version: 0.17.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-io