puma 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.txt +8 -0
- data/README.md +31 -1
- data/lib/puma/const.rb +1 -1
- data/lib/puma/server.rb +46 -72
- data/puma.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e39b5bfaf5412e8f121f6b9328daf7fa584660b
|
4
|
+
data.tar.gz: e51cb8a8d699a649016b13be0244a6cd3156f85a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb73af5cfd7aa7e56c89356e1a0d1a2aba5fd8f479a92075d567d7edd46d73df1511802d6b5bec94e2086ad6391987bbc6ca84b2ba7187e19ba3e8acfc4de52e
|
7
|
+
data.tar.gz: 69a5de1661aad1e70548bf44043dbd2957cc8144f79b9b79cf50ba7ec24a072562301090cd2d2a7d6eeaf9e77994c16e80148f5c3ef832dd065058576bf4e48e
|
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 3.0.1 / 2016-02-25
|
2
|
+
|
3
|
+
* 1 bug fix:
|
4
|
+
|
5
|
+
* Removed the experimental support for async.callback as it broke
|
6
|
+
websockets entirely. Seems no server has both hijack and async.callback
|
7
|
+
and thus faye is totally confused what to do and doesn't work.
|
8
|
+
|
1
9
|
=== 3.0.0 / 2016-02-25
|
2
10
|
|
3
11
|
* 2 major changes:
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Puma: A Ruby Web Server Built For Concurrency
|
2
2
|
|
3
|
-
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/puma/puma?
|
3
|
+
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/puma/puma?utm\_source=badge&utm\_medium=badge&utm\_campaign=pr-badge)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/puma/puma.svg)](http://travis-ci.org/puma/puma)
|
5
5
|
[![Dependency Status](https://gemnasium.com/puma/puma.svg)](https://gemnasium.com/puma/puma)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/puma/puma.svg)](https://codeclimate.com/github/puma/puma)
|
@@ -29,6 +29,36 @@ Now you should have the `puma` command available in your PATH, so just do the fo
|
|
29
29
|
|
30
30
|
$ puma app.ru
|
31
31
|
|
32
|
+
## Plugins
|
33
|
+
|
34
|
+
Puma 3.0 added support for plugins that can augment configuration and service operations.
|
35
|
+
|
36
|
+
2 canonical plugins to look to aid in development of further plugins:
|
37
|
+
|
38
|
+
* [tmp\_restart](https://github.com/puma/puma/blob/master/lib/puma/plugin/tmp_restart.rb): Restarts the server if the file `tmp/restart.txt` is touched
|
39
|
+
* [heroku](https://github.com/puma/puma-heroku/blob/master/lib/puma/plugin/heroku.rb): Packages up the default configuration used by puma on Heroku
|
40
|
+
|
41
|
+
Plugins are activated in a puma configuration file (such as `config/puma.rb'`) by adding `plugin "name"`, such as `plugin "heroku"`.
|
42
|
+
|
43
|
+
Plugins are activated based simply on path requirements so, activating the `heroku` plugin will simply be doing `require "puma/plugin/heroku"`. This allows gems to provide multiple plugins (as well as unrelated gems to provide puma plugins).
|
44
|
+
|
45
|
+
The `tmp_restart` plugin is bundled with puma, so it can always be used.
|
46
|
+
|
47
|
+
To use the `heroku` plugin, add `puma-heroku` to your Gemfile or install it.
|
48
|
+
|
49
|
+
### API
|
50
|
+
|
51
|
+
At present, there are 2 hooks that plugins can use: `start` and `config`.
|
52
|
+
|
53
|
+
`start` runs when the server has started and allows the plugin to start other functionality to augment puma.
|
54
|
+
|
55
|
+
`config` runs when the server is being configured and is passed a `Puma::DSL` object that can be used to add additional configuration.
|
56
|
+
|
57
|
+
Any public methods in `Puma::Plugin` are the public API that any plugin may use.
|
58
|
+
|
59
|
+
In the future, more hooks and APIs will be added.
|
60
|
+
|
61
|
+
|
32
62
|
## Advanced Setup
|
33
63
|
|
34
64
|
### Sinatra
|
data/lib/puma/const.rb
CHANGED
data/lib/puma/server.rb
CHANGED
@@ -520,20 +520,63 @@ module Puma
|
|
520
520
|
env['HTTP_X_FORWARDED_PROTO'] == 'https' ? PORT_443 : PORT_80
|
521
521
|
end
|
522
522
|
|
523
|
-
|
523
|
+
# Given the request +env+ from +client+ and a partial request body
|
524
|
+
# in +body+, finish reading the body if there is one and invoke
|
525
|
+
# the rack app. Then construct the response and write it back to
|
526
|
+
# +client+
|
527
|
+
#
|
528
|
+
# +cl+ is the previously fetched Content-Length header if there
|
529
|
+
# was one. This is an optimization to keep from having to look
|
530
|
+
# it up again.
|
531
|
+
#
|
532
|
+
def handle_request(req, lines)
|
533
|
+
env = req.env
|
524
534
|
client = req.io
|
525
535
|
|
536
|
+
normalize_env env, req
|
537
|
+
|
538
|
+
env[PUMA_SOCKET] = client
|
539
|
+
|
540
|
+
if env[HTTPS_KEY] && client.peercert
|
541
|
+
env[PUMA_PEERCERT] = client.peercert
|
542
|
+
end
|
543
|
+
|
544
|
+
env[HIJACK_P] = true
|
545
|
+
env[HIJACK] = req
|
546
|
+
|
526
547
|
body = req.body
|
527
548
|
|
528
549
|
head = env[REQUEST_METHOD] == HEAD
|
529
550
|
|
551
|
+
env[RACK_INPUT] = body
|
552
|
+
env[RACK_URL_SCHEME] = env[HTTPS_KEY] ? HTTPS : HTTP
|
553
|
+
|
530
554
|
# A rack extension. If the app writes #call'ables to this
|
531
555
|
# array, we will invoke them when the request is done.
|
532
556
|
#
|
533
|
-
|
534
|
-
after_reply = env[RACK_AFTER_REPLY]
|
557
|
+
after_reply = env[RACK_AFTER_REPLY] = []
|
535
558
|
|
536
559
|
begin
|
560
|
+
begin
|
561
|
+
status, headers, res_body = @app.call(env)
|
562
|
+
|
563
|
+
return :async if req.hijacked
|
564
|
+
|
565
|
+
status = status.to_i
|
566
|
+
|
567
|
+
if status == -1
|
568
|
+
unless headers.empty? and res_body == []
|
569
|
+
raise "async response must have empty headers and body"
|
570
|
+
end
|
571
|
+
|
572
|
+
return :async
|
573
|
+
end
|
574
|
+
rescue StandardError => e
|
575
|
+
@events.unknown_error self, e, "Rack app"
|
576
|
+
|
577
|
+
status, headers, res_body = lowlevel_error(e, env)
|
578
|
+
end
|
579
|
+
|
537
580
|
content_length = nil
|
538
581
|
no_body = head
|
539
582
|
|
@@ -675,75 +718,6 @@ module Puma
|
|
675
718
|
return keep_alive
|
676
719
|
end
|
677
720
|
|
678
|
-
# Given the request +env+ from +client+ and a partial request body
|
679
|
-
# in +body+, finish reading the body if there is one and invoke
|
680
|
-
# the rack app. Then construct the response and write it back to
|
681
|
-
# +client+
|
682
|
-
#
|
683
|
-
# +cl+ is the previously fetched Content-Length header if there
|
684
|
-
# was one. This is an optimization to keep from having to look
|
685
|
-
# it up again.
|
686
|
-
#
|
687
|
-
def handle_request(req, lines)
|
688
|
-
env = req.env
|
689
|
-
client = req.io
|
690
|
-
|
691
|
-
normalize_env env, req
|
692
|
-
|
693
|
-
env[PUMA_SOCKET] = client
|
694
|
-
|
695
|
-
if env[HTTPS_KEY] && client.peercert
|
696
|
-
env[PUMA_PEERCERT] = client.peercert
|
697
|
-
end
|
698
|
-
|
699
|
-
env[HIJACK_P] = true
|
700
|
-
env[HIJACK] = req
|
701
|
-
|
702
|
-
env['async.callback'] = lambda { |__response|
|
703
|
-
_status, _headers, _res_body = __response
|
704
|
-
# Faye websocket gem also calls this (when available)
|
705
|
-
# with status=101, and res_body being a stream
|
706
|
-
# but calling here just finishes the response
|
707
|
-
# that's why we only response if the request is not
|
708
|
-
# hijacked. not sure if this is a correct solution
|
709
|
-
# but working. for now.
|
710
|
-
unless req.hijacked
|
711
|
-
handle_app_response(req, lines, env, _status, _headers, _res_body)
|
712
|
-
end
|
713
|
-
}
|
714
|
-
|
715
|
-
body = req.body
|
716
|
-
|
717
|
-
env[RACK_INPUT] = body
|
718
|
-
env[RACK_URL_SCHEME] = env[HTTPS_KEY] ? HTTPS : HTTP
|
719
|
-
|
720
|
-
env[RACK_AFTER_REPLY] = []
|
721
|
-
|
722
|
-
begin
|
723
|
-
status, headers, res_body = @app.call(env)
|
724
|
-
|
725
|
-
return :async if req.hijacked
|
726
|
-
|
727
|
-
status = status.to_i
|
728
|
-
|
729
|
-
if status == -1
|
730
|
-
# unless headers.empty? and res_body == []
|
731
|
-
# puts "HEADERS: ".white.on_green + headers.inspect
|
732
|
-
# puts "BODY: ".white.on_green + res_body.inspect
|
733
|
-
# raise "async response must have empty headers and body"
|
734
|
-
# end
|
735
|
-
|
736
|
-
return :async
|
737
|
-
end
|
738
|
-
rescue StandardError => e
|
739
|
-
@events.unknown_error self, e, "Rack app"
|
740
|
-
|
741
|
-
status, headers, res_body = lowlevel_error(e, env)
|
742
|
-
end
|
743
|
-
|
744
|
-
return handle_app_response(req, lines, env, status, headers, res_body)
|
745
|
-
end
|
746
|
-
|
747
721
|
def fetch_status_code(status)
|
748
722
|
HTTP_STATUS_CODES.fetch(status) { 'CUSTOM' }
|
749
723
|
end
|
data/puma.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
18
18
|
s.authors = ["Evan Phoenix"]
|
19
19
|
s.date = `git log --pretty="%ai" -n 1`.split(" ").first
|
20
|
-
s.description = "Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications. Puma is intended for use in both development and production environments.
|
20
|
+
s.description = "Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications. Puma is intended for use in both development and production environments. It's great for highly concurrent Ruby implementations such as Rubinius and JRuby as well as as providing process worker support to support CRuby well."
|
21
21
|
s.email = ["evan@phx.io"]
|
22
22
|
s.executables = ["puma", "pumactl"]
|
23
23
|
s.extensions = ["ext/puma_http11/extconf.rb"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|