falcon 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfbbbd80fcbe0e419ff2d26f22004bba0fb8bb6674b508b253ebdc44729abebe
4
- data.tar.gz: 0dc2c1e25e1e1a5bf19d843ef3b803ebacc855417cdd460bd3e971d8e3ed6e0a
3
+ metadata.gz: 66c04e989c96c5f1697da180ebe132a455329f0e803540715ca8f3a2bfcb84fb
4
+ data.tar.gz: ae0cc071336afeee37f05b9612a3a570031c0f48025d2199c6c1f0bf61224de6
5
5
  SHA512:
6
- metadata.gz: 4bc9ea031a37477c780688caa3ed0ad19625fd91c74f7bc148b7fd83511e4ee646edf4dc85a64521a347e93742b3dbb317781fa4abd26f4074148093d662d335
7
- data.tar.gz: 9da626f01d30cfaa3a30174b8fc73eeba209d632cafe708c2d56b6cec7840ea818a6cb1883c3435508ba7a6f5256a1d977c0b255a855081dc9d67c618ef1b12d
6
+ metadata.gz: b92e6e896f8db1cce3bffa327ccf3273e7bf56e15e83d5f88b915d489df7070140ab7ffcac10efdb6fee1ed53dedc7342af89c0ad8c62eb7cae8bd7223c65bb9
7
+ data.tar.gz: 1360099213526fc4a8c50fb5595acc13f173552c655b3fb79716cfcdd535d3d9a9e674d540f61c3b841e3549ba04780218e28331283789d28a9f36cca21a7600
data/.travis.yml CHANGED
@@ -1,10 +1,9 @@
1
1
  language: ruby
2
- sudo: required
3
- dist: xenial
4
2
  cache: bundler
5
3
 
6
4
  before_script:
7
5
  - gem update --system
6
+ - gem install bundler
8
7
 
9
8
  matrix:
10
9
  include:
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env falcon --verbose serve -c
2
+
3
+ def bottles(n)
4
+ n == 1 ? "#{n} bottle" : "#{n} bottles"
5
+ end
6
+
7
+ # Browsers don't show streaming content until a certain threshold has been met. For most browers, it's about 1024 bytes. So, we have a comment of about that length which we feed to the client before streaming actual content. For more details see https://stackoverflow.com/questions/16909227
8
+ COMMENT = "<!--#{'-' * 1024}-->"
9
+
10
+ run lambda {|env|
11
+ task = Async::Task.current
12
+ body = Async::HTTP::Body.new
13
+
14
+ body.write("<!DOCTYPE html><html><head><title>99 Bottles of Beer</title></head><body>")
15
+
16
+ task.async do |task|
17
+ body.write(COMMENT)
18
+
19
+ 99.downto(1) do |i|
20
+ puts "#{bottles(i)} of beer on the wall..."
21
+ body.write("<p>#{bottles(i)} of beer on the wall, ")
22
+ task.sleep(1)
23
+ body.write("#{bottles(i)} of beer, ")
24
+ task.sleep(1)
25
+ body.write("take one down and pass it around, ")
26
+ task.sleep(1)
27
+ body.write("#{bottles(i-1)} of beer on the wall.</p>")
28
+ task.sleep(1)
29
+ body.write("<script>var child; while (child = document.body.firstChild) child.remove();</script>")
30
+ end
31
+
32
+ body.write("</body></html>")
33
+ rescue
34
+ puts "Remote end closed connection: #{$!}"
35
+ ensure
36
+ body.finish
37
+ end
38
+
39
+ [200, {'content-type' => 'text/html; charset=utf-8'}, body]
40
+ }
data/falcon.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.authors = ["Samuel Williams"]
8
8
  spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
9
 
10
- spec.summary = ""
10
+ spec.summary = "A fast, asynchronous, rack-compatible web server."
11
11
  spec.homepage = "https://github.com/socketry/falcon"
12
12
 
13
13
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_dependency("async-io", "~> 1.6")
20
- spec.add_dependency("async-http", "~> 0.15")
20
+ spec.add_dependency("async-http", "~> 0.17")
21
21
  spec.add_dependency("async-container", "~> 0.3")
22
22
 
23
23
  spec.add_dependency("rack", ">= 1.0")
@@ -40,12 +40,13 @@ module Falcon
40
40
 
41
41
  request_method = env['REQUEST_METHOD']
42
42
  request_path = env['PATH_INFO']
43
+ server_protocol = env['SERVER_PROTOCOL']
43
44
 
44
45
  if response
45
46
  status, headers, body = response
46
- @logger.info "#{request_method} #{request_path} -> #{status}; Content length #{headers.fetch('Content-Length', '-')} bytes; took #{duration} seconds"
47
+ @logger.info "#{request_method} #{request_path} #{server_protocol} -> #{status}; Content length #{headers.fetch('Content-Length', '-')} bytes; took #{duration} seconds"
47
48
  else
48
- @logger.info "#{request_method} #{request_path} -> #{error}; took #{duration} seconds"
49
+ @logger.info "#{request_method} #{request_path} #{server_protocol} -> #{error}; took #{duration} seconds"
49
50
  end
50
51
  end
51
52
 
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.11.0"
22
+ VERSION = "0.12.0"
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.11.0
4
+ version: 0.12.0
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-04-10 00:00:00.000000000 Z
11
+ date: 2018-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-io
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.15'
33
+ version: '0.17'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.15'
40
+ version: '0.17'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: async-container
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -151,6 +151,7 @@ files:
151
151
  - README.md
152
152
  - Rakefile
153
153
  - bin/falcon
154
+ - examples/beer/config.ru
154
155
  - examples/hello/config.ru
155
156
  - examples/sinatra/Gemfile
156
157
  - examples/sinatra/Gemfile.lock
@@ -186,5 +187,5 @@ rubyforge_project:
186
187
  rubygems_version: 2.7.6
187
188
  signing_key:
188
189
  specification_version: 4
189
- summary: ''
190
+ summary: A fast, asynchronous, rack-compatible web server.
190
191
  test_files: []