puma 3.11.0 → 3.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc80f23863511d940c0cd4139b67605fda3e943a
4
- data.tar.gz: 26362306ddc252d008e729e517ec6821a62c6f4c
3
+ metadata.gz: a6e4639dc3ace8a60125068633a63025ca87ad00
4
+ data.tar.gz: 61b9f2e83b05bafad0bdf79c325e3a0c27cae321
5
5
  SHA512:
6
- metadata.gz: d103e80ccccc54908cee56769221c8533b6d0ab366e1d4b749a309a082be23be8440656058f39e39fc59b9ae8f33d957f954c734b5badbfd7c90d056f9e45136
7
- data.tar.gz: e0f2dd434998331662ac42e38694eecebf32f836769aef6e6d3815ff3cdb8089de3b743aae44f72a92bd86292a5b1e189cb176aa824a426a7e6e41047f91cf7f
6
+ metadata.gz: 12956a78e42981a073760503849653685bb8e73f1a00493038e38aae34fd23901e35e1abf5ef3a08517e736ea8e1c72912dab1f87e47b4feebd3bd3b00f79452
7
+ data.tar.gz: 0c5e19a059c67816cc74f705193a0dfd6dadb52eae35526150f754a6f6b359b8243fb602c43f6bcc8fd0f13d440f512497d3c9a349eb48a4dbdb93efa6949651
data/History.md CHANGED
@@ -1,7 +1,12 @@
1
+ ## 3.11.1 / 2018-01-18
2
+
3
+ * 1 bugfix:
4
+ * Handle read\_nonblock returning nil when the socket close (#1502)
5
+
1
6
  ## 3.11.0 / 2017-11-20
2
7
 
3
8
  * 2 features:
4
- * HTTP 203 Early Hints (#1403)
9
+ * HTTP 103 Early Hints (#1403)
5
10
  * 421/451 status codes now have correct status messages attached (#1435)
6
11
 
7
12
  * 9 bugfixes:
@@ -41,11 +41,14 @@ static const int puma_parser_start = 1;
41
41
  static const int puma_parser_first_final = 47;
42
42
  static const int puma_parser_error = 0;
43
43
 
44
+ static const int puma_parser_en_main = 1;
45
+
46
+
44
47
  #line 83 "ext/puma_http11/http11_parser.rl"
45
48
 
46
49
  int puma_parser_init(puma_parser *parser) {
47
50
  int cs = 0;
48
-
51
+
49
52
  #line 53 "ext/puma_http11/http11_parser.c"
50
53
  {
51
54
  cs = puma_parser_start;
@@ -71,9 +74,15 @@ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len,
71
74
  const char *p, *pe;
72
75
  int cs = parser->cs;
73
76
 
77
+ assert(off <= len && "offset past end of buffer");
78
+
74
79
  p = buffer+off;
75
80
  pe = buffer+len;
76
81
 
82
+ /* assert(*pe == '\0' && "pointer does not end on NUL"); */
83
+ assert((size_t) (pe - p) == len - off && "pointers aren't same distance");
84
+
85
+
77
86
  #line 87 "ext/puma_http11/http11_parser.c"
78
87
  {
79
88
  if ( p == pe )
@@ -973,52 +982,52 @@ case 46:
973
982
  goto tr2;
974
983
  goto st0;
975
984
  }
976
- _test_eof2: cs = 2; goto _test_eof;
977
- _test_eof3: cs = 3; goto _test_eof;
978
- _test_eof4: cs = 4; goto _test_eof;
979
- _test_eof5: cs = 5; goto _test_eof;
980
- _test_eof6: cs = 6; goto _test_eof;
981
- _test_eof7: cs = 7; goto _test_eof;
982
- _test_eof8: cs = 8; goto _test_eof;
983
- _test_eof9: cs = 9; goto _test_eof;
984
- _test_eof10: cs = 10; goto _test_eof;
985
- _test_eof11: cs = 11; goto _test_eof;
986
- _test_eof12: cs = 12; goto _test_eof;
987
- _test_eof13: cs = 13; goto _test_eof;
988
- _test_eof14: cs = 14; goto _test_eof;
989
- _test_eof15: cs = 15; goto _test_eof;
990
- _test_eof16: cs = 16; goto _test_eof;
991
- _test_eof47: cs = 47; goto _test_eof;
992
- _test_eof17: cs = 17; goto _test_eof;
993
- _test_eof18: cs = 18; goto _test_eof;
994
- _test_eof19: cs = 19; goto _test_eof;
995
- _test_eof20: cs = 20; goto _test_eof;
996
- _test_eof21: cs = 21; goto _test_eof;
997
- _test_eof22: cs = 22; goto _test_eof;
998
- _test_eof23: cs = 23; goto _test_eof;
999
- _test_eof24: cs = 24; goto _test_eof;
1000
- _test_eof25: cs = 25; goto _test_eof;
1001
- _test_eof26: cs = 26; goto _test_eof;
1002
- _test_eof27: cs = 27; goto _test_eof;
1003
- _test_eof28: cs = 28; goto _test_eof;
1004
- _test_eof29: cs = 29; goto _test_eof;
1005
- _test_eof30: cs = 30; goto _test_eof;
1006
- _test_eof31: cs = 31; goto _test_eof;
1007
- _test_eof32: cs = 32; goto _test_eof;
1008
- _test_eof33: cs = 33; goto _test_eof;
1009
- _test_eof34: cs = 34; goto _test_eof;
1010
- _test_eof35: cs = 35; goto _test_eof;
1011
- _test_eof36: cs = 36; goto _test_eof;
1012
- _test_eof37: cs = 37; goto _test_eof;
1013
- _test_eof38: cs = 38; goto _test_eof;
1014
- _test_eof39: cs = 39; goto _test_eof;
1015
- _test_eof40: cs = 40; goto _test_eof;
1016
- _test_eof41: cs = 41; goto _test_eof;
1017
- _test_eof42: cs = 42; goto _test_eof;
1018
- _test_eof43: cs = 43; goto _test_eof;
1019
- _test_eof44: cs = 44; goto _test_eof;
1020
- _test_eof45: cs = 45; goto _test_eof;
1021
- _test_eof46: cs = 46; goto _test_eof;
985
+ _test_eof2: cs = 2; goto _test_eof;
986
+ _test_eof3: cs = 3; goto _test_eof;
987
+ _test_eof4: cs = 4; goto _test_eof;
988
+ _test_eof5: cs = 5; goto _test_eof;
989
+ _test_eof6: cs = 6; goto _test_eof;
990
+ _test_eof7: cs = 7; goto _test_eof;
991
+ _test_eof8: cs = 8; goto _test_eof;
992
+ _test_eof9: cs = 9; goto _test_eof;
993
+ _test_eof10: cs = 10; goto _test_eof;
994
+ _test_eof11: cs = 11; goto _test_eof;
995
+ _test_eof12: cs = 12; goto _test_eof;
996
+ _test_eof13: cs = 13; goto _test_eof;
997
+ _test_eof14: cs = 14; goto _test_eof;
998
+ _test_eof15: cs = 15; goto _test_eof;
999
+ _test_eof16: cs = 16; goto _test_eof;
1000
+ _test_eof47: cs = 47; goto _test_eof;
1001
+ _test_eof17: cs = 17; goto _test_eof;
1002
+ _test_eof18: cs = 18; goto _test_eof;
1003
+ _test_eof19: cs = 19; goto _test_eof;
1004
+ _test_eof20: cs = 20; goto _test_eof;
1005
+ _test_eof21: cs = 21; goto _test_eof;
1006
+ _test_eof22: cs = 22; goto _test_eof;
1007
+ _test_eof23: cs = 23; goto _test_eof;
1008
+ _test_eof24: cs = 24; goto _test_eof;
1009
+ _test_eof25: cs = 25; goto _test_eof;
1010
+ _test_eof26: cs = 26; goto _test_eof;
1011
+ _test_eof27: cs = 27; goto _test_eof;
1012
+ _test_eof28: cs = 28; goto _test_eof;
1013
+ _test_eof29: cs = 29; goto _test_eof;
1014
+ _test_eof30: cs = 30; goto _test_eof;
1015
+ _test_eof31: cs = 31; goto _test_eof;
1016
+ _test_eof32: cs = 32; goto _test_eof;
1017
+ _test_eof33: cs = 33; goto _test_eof;
1018
+ _test_eof34: cs = 34; goto _test_eof;
1019
+ _test_eof35: cs = 35; goto _test_eof;
1020
+ _test_eof36: cs = 36; goto _test_eof;
1021
+ _test_eof37: cs = 37; goto _test_eof;
1022
+ _test_eof38: cs = 38; goto _test_eof;
1023
+ _test_eof39: cs = 39; goto _test_eof;
1024
+ _test_eof40: cs = 40; goto _test_eof;
1025
+ _test_eof41: cs = 41; goto _test_eof;
1026
+ _test_eof42: cs = 42; goto _test_eof;
1027
+ _test_eof43: cs = 43; goto _test_eof;
1028
+ _test_eof44: cs = 44; goto _test_eof;
1029
+ _test_eof45: cs = 45; goto _test_eof;
1030
+ _test_eof46: cs = 46; goto _test_eof;
1022
1031
 
1023
1032
  _test_eof: {}
1024
1033
  _out: {}
@@ -1030,6 +1039,13 @@ case 46:
1030
1039
  parser->cs = cs;
1031
1040
  parser->nread += p - (buffer + off);
1032
1041
 
1042
+ assert(p <= pe && "buffer overflow after parsing execute");
1043
+ assert(parser->nread <= len && "nread longer than length");
1044
+ assert(parser->body_start <= len && "body starts after buffer end");
1045
+ assert(parser->mark < len && "mark is after buffer end");
1046
+ assert(parser->field_len <= len && "field has length longer than whole buffer");
1047
+ assert(parser->field_start < len && "field starts after buffer end");
1048
+
1033
1049
  return(parser->nread);
1034
1050
  }
1035
1051
 
@@ -120,7 +120,7 @@ module Puma
120
120
 
121
121
  umask = nil
122
122
  mode = nil
123
- backlog = nil
123
+ backlog = 1024
124
124
 
125
125
  if uri.query
126
126
  params = Util.parse_query uri.query
@@ -344,7 +344,7 @@ module Puma
344
344
 
345
345
  # Tell the server to listen on +path+ as a UNIX domain socket.
346
346
  #
347
- def add_unix_listener(path, umask=nil, mode=nil, backlog=nil)
347
+ def add_unix_listener(path, umask=nil, mode=nil, backlog=1024)
348
348
  @unix_paths << path
349
349
 
350
350
  # Let anyone connect by default
@@ -365,7 +365,7 @@ module Puma
365
365
  end
366
366
 
367
367
  s = UNIXServer.new(path)
368
- s.listen backlog if backlog
368
+ s.listen backlog
369
369
  @ios << s
370
370
  ensure
371
371
  File.umask old_mask
@@ -279,8 +279,8 @@ module Puma
279
279
  while true
280
280
  sleep WORKER_CHECK_INTERVAL
281
281
  begin
282
- b = server.backlog
283
- r = server.running
282
+ b = server.backlog || 0
283
+ r = server.running || 0
284
284
  payload = %Q!#{base_payload}{ "backlog":#{b}, "running":#{r} }\n!
285
285
  io << payload
286
286
  rescue IOError
@@ -340,7 +340,7 @@ module Puma
340
340
  def stats
341
341
  old_worker_count = @workers.count { |w| w.phase != @phase }
342
342
  booted_worker_count = @workers.count { |w| w.booted? }
343
- worker_status = '[' + @workers.map{ |w| %Q!{ "pid": #{w.pid}, "index": #{w.index}, "phase": #{w.phase}, "booted": #{w.booted?}, "last_checkin": "#{w.last_checkin.utc.iso8601}", "last_status": #{w.last_status} }!}.join(",") + ']'
343
+ worker_status = '[' + @workers.map { |w| %Q!{ "pid": #{w.pid}, "index": #{w.index}, "phase": #{w.phase}, "booted": #{w.booted?}, "last_checkin": "#{w.last_checkin.utc.iso8601}", "last_status": #{w.last_status} }!}.join(",") + ']'
344
344
  %Q!{ "workers": #{@workers.size}, "phase": #{@phase}, "booted_workers": #{booted_worker_count}, "old_workers": #{old_worker_count}, "worker_status": #{worker_status} }!
345
345
  end
346
346
 
@@ -180,7 +180,7 @@ module Puma
180
180
  :worker_shutdown_timeout => DefaultWorkerShutdownTimeout,
181
181
  :remote_address => :socket,
182
182
  :tag => method(:infer_tag),
183
- :environment => ->{ ENV['RACK_ENV'] || "development" },
183
+ :environment => -> { ENV['RACK_ENV'] || "development" },
184
184
  :rackup => DefaultRackup,
185
185
  :logger => STDOUT,
186
186
  :persistent_timeout => Const::PERSISTENT_TIMEOUT,
@@ -98,7 +98,7 @@ module Puma
98
98
  # too taxing on performance.
99
99
  module Const
100
100
 
101
- PUMA_VERSION = VERSION = "3.11.0".freeze
101
+ PUMA_VERSION = VERSION = "3.11.1".freeze
102
102
  CODE_NAME = "Love Song".freeze
103
103
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
104
104
 
@@ -110,9 +110,22 @@ module Puma
110
110
  @options[:config_files] << file
111
111
  end
112
112
 
113
- # Bind the server to +url+. tcp:// and unix:// are the only accepted
114
- # protocols.
113
+ # Adds a binding for the server to +url+. tcp://, unix://, and ssl:// are the only accepted
114
+ # protocols. Use query parameters within the url to specify options.
115
115
  #
116
+ # @note multiple urls can be bound to, calling `bind` does not overwrite previous bindings.
117
+ #
118
+ # @example Explicitly the socket backlog depth (default is 1024)
119
+ # bind('unix:///var/run/puma.sock?backlog=2048')
120
+ #
121
+ # @example Set up ssl cert
122
+ # bind('ssl://127.0.0.1:9292?key=key.key&cert=cert.pem')
123
+ #
124
+ # @example Prefer low-latency over higher throughput (via `Socket::TCP_NODELAY`)
125
+ # bind('tcp://0.0.0.0:9292?low_latency=true')
126
+ #
127
+ # @example Set socket permissions
128
+ # bind('unix:///var/run/puma.sock?umask=0111')
116
129
  def bind(url)
117
130
  @options[:binds] ||= []
118
131
  @options[:binds] << url
@@ -58,6 +58,8 @@ module Puma
58
58
  else
59
59
  IO.select(nil, [@socket.to_io])
60
60
  end
61
+ elsif !data
62
+ return nil
61
63
  else
62
64
  break
63
65
  end
@@ -5,8 +5,8 @@ require 'puma/plugin'
5
5
  module Puma
6
6
  class Single < Runner
7
7
  def stats
8
- b = @server.backlog
9
- r = @server.running
8
+ b = @server.backlog || 0
9
+ r = @server.running || 0
10
10
  %Q!{ "backlog": #{b}, "running": #{r} }!
11
11
  end
12
12
 
@@ -53,7 +53,7 @@ module Puma
53
53
  attr_accessor :clean_thread_locals
54
54
 
55
55
  def self.clean_thread_locals
56
- Thread.current.keys.each do |key|
56
+ Thread.current.keys.each do |key| # rubocop: disable Performance/HashEachMethods
57
57
  Thread.current[key] = nil unless key == :__recursive_key__
58
58
  end
59
59
  end
@@ -21,7 +21,7 @@ module Rack
21
21
  # contains an array of all explicitly defined user options. We then
22
22
  # know that all other values are defaults
23
23
  if user_supplied_options = options.delete(:user_supplied_options)
24
- (options.keys - user_supplied_options).each do |k, v|
24
+ (options.keys - user_supplied_options).each do |k|
25
25
  default_options[k] = options.delete(k)
26
26
  end
27
27
  end
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.11.0
4
+ version: 3.11.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: 2017-11-20 00:00:00.000000000 Z
11
+ date: 2018-01-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
14
14
  for Ruby/Rack applications. Puma is intended for use in both development and production
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.6.13
124
+ rubygems_version: 2.6.8
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for