puma 3.8.2-java → 3.9.0-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
- SHA1:
3
- metadata.gz: 91719dbea8ca6efae2e28fd0e1b1ea277e3bd9a2
4
- data.tar.gz: 8dea9d3913293bda4c2e466ba1139bda10e0e4b7
2
+ SHA256:
3
+ metadata.gz: 732dee7ffb2ceda13d69428f9e772c4ea057657381d4d28c7d3f231f9ba69fe3
4
+ data.tar.gz: 04daf75954082bb4d5409ee2767fabd0af551852e10ef758c717c91cd47d4870
5
5
  SHA512:
6
- metadata.gz: 3dd382f9c20d221bf8b1fa9278aca6538c4ede1d284d23390706f913229a0f2f401da63ad82c3110519dc8f946919e06ac04b73da25d84f50420370f7e185d21
7
- data.tar.gz: 73f2c6615370e2466012d166af27231e5689c84decee4629401a0e45e2a0e75a1bcc7b1ca2d30d6054401c810f5cdb327a940da63b4d2b0ca917705b3f652605
6
+ metadata.gz: 21b32948cc3eb9b49700abf54a4552be79cdcce095ebe4d47a854b21906cfd1bb5afff262e62d0fffeb146992806f2bdca43d36c3fff5df963d25b987573735b
7
+ data.tar.gz: b8e5f42f7302e957ab4b67d4879d1000fcd33a0853268ca2a0086c7b23427f866bd222d8754686b34dfc730f61d865dd69783b958a079602e5808021d7672494
data/History.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## 3.9.0 / 2017-06-01
2
+
3
+ * 2 features:
4
+ * The ENV is now reset to its original values when Puma restarts via USR1/USR2 (#1260) (MRI only, no JRuby support)
5
+ * Puma will no longer accept more clients than the maximum number of threads. (#1278)
6
+
7
+ * 9 bugfixes:
8
+ * Reduce information leakage by preventing HTTP parse errors from writing environment hashes to STDERR (#1306)
9
+ * Fix SSL/WebSocket compatibility (#1274)
10
+ * HTTP headers with empty values are no longer omitted from responses. (#1261)
11
+ * Fix a Rack env key which was set to nil. (#1259)
12
+ * peercert has been implemented for JRuby (#1248)
13
+ * Fix port settings when using rails s (#1277, #1290)
14
+ * Fix compat w/LibreSSL (#1285)
15
+ * Fix restarting Puma w/symlinks and a new Gemfile (#1282)
16
+ * Replace Dir.exists? with Dir.exist? (#1294)
17
+
18
+ * 1 known issue:
19
+ * A bug in MRI 2.2+ can result in IOError: stream closed. See #1206. This issue has existed since at least Puma 3.6, and probably further back.
20
+
21
+ * 1 refactor:
22
+ * Lots of test fixups from @grosser.
23
+
1
24
  ## 3.8.2 / 2017-03-14
2
25
 
3
26
  * 1 bugfix:
@@ -88,7 +88,7 @@ DH *get_dh1024() {
88
88
  DH *dh;
89
89
  dh = DH_new();
90
90
 
91
- #if OPENSSL_VERSION_NUMBER < 0x10100005L
91
+ #if OPENSSL_VERSION_NUMBER < 0x10100005L || defined(LIBRESSL_VERSION_NUMBER)
92
92
  dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
93
93
  dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
94
94
 
@@ -6,6 +6,7 @@ import org.jruby.RubyModule;
6
6
  import org.jruby.RubyObject;
7
7
  import org.jruby.RubyString;
8
8
  import org.jruby.anno.JRubyMethod;
9
+ import org.jruby.javasupport.JavaEmbedUtils;
9
10
  import org.jruby.runtime.Block;
10
11
  import org.jruby.runtime.ObjectAllocator;
11
12
  import org.jruby.runtime.ThreadContext;
@@ -18,6 +19,7 @@ import javax.net.ssl.SSLContext;
18
19
  import javax.net.ssl.SSLEngine;
19
20
  import javax.net.ssl.SSLEngineResult;
20
21
  import javax.net.ssl.SSLException;
22
+ import javax.net.ssl.SSLPeerUnverifiedException;
21
23
  import javax.net.ssl.SSLSession;
22
24
  import java.io.FileInputStream;
23
25
  import java.io.IOException;
@@ -27,6 +29,7 @@ import java.security.KeyStore;
27
29
  import java.security.KeyStoreException;
28
30
  import java.security.NoSuchAlgorithmException;
29
31
  import java.security.UnrecoverableKeyException;
32
+ import java.security.cert.CertificateEncodingException;
30
33
  import java.security.cert.CertificateException;
31
34
 
32
35
  import static javax.net.ssl.SSLEngineResult.Status;
@@ -333,7 +336,11 @@ public class MiniSSL extends RubyObject {
333
336
  }
334
337
 
335
338
  @JRubyMethod
336
- public IRubyObject peercert() {
337
- return getRuntime().getNil();
339
+ public IRubyObject peercert() throws CertificateEncodingException {
340
+ try {
341
+ return JavaEmbedUtils.javaToRuby(getRuntime(), engine.getSession().getPeerCertificates()[0].getEncoded());
342
+ } catch (SSLPeerUnverifiedException ex) {
343
+ return getRuntime().getNil();
344
+ }
338
345
  }
339
346
  }
@@ -95,8 +95,8 @@ module Puma
95
95
  # too taxing on performance.
96
96
  module Const
97
97
 
98
- PUMA_VERSION = VERSION = "3.8.2".freeze
99
- CODE_NAME = "Sassy Salamander".freeze
98
+ PUMA_VERSION = VERSION = "3.9.0".freeze
99
+ CODE_NAME = "Private Caller".freeze
100
100
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
101
101
 
102
102
  FAST_TRACK_KA_TIMEOUT = 0.2
@@ -91,8 +91,7 @@ module Puma
91
91
  # parsing exception.
92
92
  #
93
93
  def parse_error(server, env, error)
94
- @stderr.puts "#{Time.now}: HTTP parse error, malformed request (#{env[HTTP_X_FORWARDED_FOR] || env[REMOTE_ADDR]}): #{error.inspect}"
95
- @stderr.puts "#{Time.now}: ENV: #{env.inspect}\n---\n"
94
+ @stderr.puts "#{Time.now}: HTTP parse error, malformed request (#{env[HTTP_X_FORWARDED_FOR] || env[REMOTE_ADDR]}): #{error.inspect}\n---\n"
96
95
  end
97
96
 
98
97
  # An SSL error has occurred.
@@ -163,6 +163,8 @@ module Puma
163
163
 
164
164
  # Run the server. This blocks until the server is stopped
165
165
  def run
166
+ previous_env = (defined?(Bundler) ? Bundler.clean_env : ENV.to_h)
167
+
166
168
  @config.clamp
167
169
 
168
170
  @config.plugins.fire_starts self
@@ -178,6 +180,7 @@ module Puma
178
180
  graceful_stop
179
181
  when :restart
180
182
  log "* Restarting..."
183
+ ENV.replace(previous_env)
181
184
  @runner.before_restart
182
185
  restart!
183
186
  when :exit
@@ -36,7 +36,9 @@ module Puma
36
36
  output
37
37
  end
38
38
 
39
- def read_nonblock(size)
39
+ def read_nonblock(size, *_)
40
+ # *_ is to deal with keyword args that were added
41
+ # at some point (and being used in the wild)
40
42
  while true
41
43
  output = engine_read_all
42
44
  return output if output
@@ -77,6 +79,19 @@ module Puma
77
79
  alias_method :syswrite, :write
78
80
  alias_method :<<, :write
79
81
 
82
+ # This is a temporary fix to deal with websockets code using
83
+ # write_nonblock. The problem with implementing it properly
84
+ # is that it means we'd have to have the ability to rewind
85
+ # an engine because after we write+extract, the socket
86
+ # write_nonblock call might raise an exception and later
87
+ # code would pass the same data in, but the engine would think
88
+ # it had already written the data in. So for the time being
89
+ # (and since write blocking is quite rare), go ahead and actually
90
+ # block in write_nonblock.
91
+ def write_nonblock(data, *_)
92
+ write data
93
+ end
94
+
80
95
  def flush
81
96
  @socket.flush
82
97
  end
Binary file
@@ -107,7 +107,7 @@ module Puma
107
107
  append = @options[:redirect_append]
108
108
 
109
109
  if stdout
110
- unless Dir.exists?(File.dirname(stdout))
110
+ unless Dir.exist?(File.dirname(stdout))
111
111
  raise "Cannot redirect STDOUT to #{stdout}"
112
112
  end
113
113
 
@@ -117,7 +117,7 @@ module Puma
117
117
  end
118
118
 
119
119
  if stderr
120
- unless Dir.exists?(File.dirname(stderr))
120
+ unless Dir.exist?(File.dirname(stderr))
121
121
  raise "Cannot redirect STDERR to #{stderr}"
122
122
  end
123
123
 
@@ -363,7 +363,7 @@ module Puma
363
363
  end
364
364
 
365
365
  pool << client
366
- pool.wait_until_not_full unless queue_requests
366
+ pool.wait_until_not_full
367
367
  end
368
368
  rescue SystemCallError
369
369
  # nothing
@@ -522,7 +522,9 @@ module Puma
522
522
 
523
523
  raise "No REQUEST PATH" unless env[REQUEST_PATH]
524
524
 
525
- env[QUERY_STRING] = uri.query
525
+ # A nil env value will cause a LintError (and fatal errors elsewhere),
526
+ # so only set the env value if there actually is a value.
527
+ env[QUERY_STRING] = uri.query if uri.query
526
528
  end
527
529
 
528
530
  env[PATH_INFO] = env[REQUEST_PATH]
@@ -687,7 +689,7 @@ module Puma
687
689
  next
688
690
  end
689
691
 
690
- if vs.respond_to?(:to_s)
692
+ if vs.respond_to?(:to_s) && !vs.to_s.empty?
691
693
  vs.to_s.split(NEWLINE).each do |v|
692
694
  lines.append k, colon, v, line_ending
693
695
  end
@@ -155,7 +155,15 @@ module Puma
155
155
 
156
156
  def wait_until_not_full
157
157
  @mutex.synchronize do
158
- until @todo.size - @waiting < @max - @spawned or @shutdown
158
+ while true
159
+ return if @shutdown
160
+ return if @waiting > 0
161
+
162
+ # If we can still spin up new threads and there
163
+ # is work queued, then accept more work until we would
164
+ # spin up the max number of threads.
165
+ return if @todo.size < @max - @spawned
166
+
159
167
  @not_full.wait @mutex
160
168
  end
161
169
  end
@@ -42,7 +42,12 @@ module Rack
42
42
  user_config.threads min, max
43
43
  end
44
44
 
45
- self.set_host_port_to_config(options[:Host], options[:Port], user_config)
45
+ if options[:Host] || options[:Port]
46
+ host = options[:Host] || default_options[:Host]
47
+ port = options[:Port] || default_options[:Port]
48
+ self.set_host_port_to_config(host, port, user_config)
49
+ end
50
+
46
51
  self.set_host_port_to_config(default_options[:Host], default_options[:Port], default_config)
47
52
 
48
53
  user_config.app app
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.2
4
+ version: 3.9.0
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-14 00:00:00.000000000 Z
11
+ date: 2017-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - "~>"
17
- - !ruby/object:Gem::Version
18
- version: '4.0'
19
- name: rdoc
20
- prerelease: false
21
- type: :development
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '4.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  requirement: !ruby/object:Gem::Requirement
29
15
  requirements:
@@ -63,7 +49,21 @@ dependencies:
63
49
  requirements:
64
50
  - - "~>"
65
51
  - !ruby/object:Gem::Version
66
- version: '3.14'
52
+ version: '4.0'
53
+ name: rdoc
54
+ prerelease: false
55
+ type: :development
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '4.0'
61
+ - !ruby/object:Gem::Dependency
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '3.15'
67
67
  name: hoe
68
68
  prerelease: false
69
69
  type: :development
@@ -71,8 +71,11 @@ dependencies:
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '3.14'
75
- 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.
74
+ version: '3.15'
75
+ description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
76
+ for Ruby/Rack applications. Puma is intended for use in both development and production
77
+ environments. In order to get the best throughput, it is highly recommended that
78
+ you use a Ruby implementation with real threads like Rubinius or JRuby.
76
79
  email:
77
80
  - evan@phx.io
78
81
  executables:
@@ -194,8 +197,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
197
  version: '0'
195
198
  requirements: []
196
199
  rubyforge_project:
197
- rubygems_version: 2.6.8
200
+ rubygems_version: 2.6.11
198
201
  signing_key:
199
202
  specification_version: 4
200
- summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications
203
+ summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
204
+ Ruby/Rack applications
201
205
  test_files: []