puma 3.0.0-java → 3.0.1-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69f64076ecd1fa06c746e71e44eb434ecd0793cd
4
- data.tar.gz: fb698f2745ee24731207d9322c0b137f54d9eb0e
3
+ metadata.gz: 7b281e8c01b8d7052006356e3d31f6e6c27257d7
4
+ data.tar.gz: 7cc629d6de4c943d751f472ba95c3c2933601ecb
5
5
  SHA512:
6
- metadata.gz: 53f16055692cc03f8a26167433d22f25556664779130c14b26f708917e055e85b9b6bb1575da8da91327b142f5b8764101b968e1d9fa55190e0996d512863fb2
7
- data.tar.gz: 8aa7f714ddf879e207f64d50a99d32d43f4c49727cde9360b4ba6f39ebe02340bf1b83b6fc75ac6c9222a5faf5409237d44c0e8940cf52defef3220bd9e2307a
6
+ metadata.gz: b4b5ede627fcd4b84140b44a108789afc46f7363ef4d2209412b1e4d5d3022676a1546a5b7c2ba986eb2d80afeecfcb56b26bf833794a2e6ed48a4058ec530d1
7
+ data.tar.gz: cc2143fae1fb0dd99476e66fa0b81f3bf5ac23cb8309ca740712efffcaa4ea885e60b64bfb309347b87a484ab581903ace064ef4b166d63a7b284e0c99d415f7
@@ -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?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
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
@@ -99,7 +99,7 @@ module Puma
99
99
  # too taxing on performance.
100
100
  module Const
101
101
 
102
- PUMA_VERSION = VERSION = "3.0.0".freeze
102
+ PUMA_VERSION = VERSION = "3.0.1".freeze
103
103
  CODE_NAME = "Plethora of Penguin Pinatas".freeze
104
104
 
105
105
  FAST_TRACK_KA_TIMEOUT = 0.2
Binary file
@@ -520,20 +520,63 @@ module Puma
520
520
  env['HTTP_X_FORWARDED_PROTO'] == 'https' ? PORT_443 : PORT_80
521
521
  end
522
522
 
523
- def handle_app_response(req, lines, env, status, headers, res_body)
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
- # (This is already initialized in `handle_request`, just getting here)
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
@@ -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. In order to get the best throughput, it is highly recommended that you use a Ruby implementation with real threads like Rubinius or JRuby."
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.0
4
+ version: 3.0.1
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement