jun-puma 1.0.0-java → 1.0.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6683b8acec0bb81cd1bf2f4a232e6944fe3a89e214c8d4956a28862042249e5
4
- data.tar.gz: 3a9dec8bfe42969355a323f4aa7a84624d6e3dd363d5367a25393e33892c09ed
3
+ metadata.gz: 0f07d6ca63cbdbe816c25b8c6abd651bbbbef00f7306f13301f1975b2ec726e3
4
+ data.tar.gz: 39b63d4115cb66dc290a43593f37e4a2efa1901c1359edad4e7ffd2650771395
5
5
  SHA512:
6
- metadata.gz: b4137d5ade45a5e7c86886ac9e3fd775e39311371530b702413d7fb6715f3db02fbb57e920e3be03196de7c29621a66fd448b8473a13ec548b2a6b25adf994d2
7
- data.tar.gz: e7be8a01d20f2baa4c52eb11f014a1a4d0f8335d3534bd59f419b8230ba0e26dfa4dcdadd1be7e220880804514205cb16979be45b21fca3f7e5f51eea6033b06
6
+ metadata.gz: 5fe0f30ad119052885c8dea934f836631f056e5d41d6b4790d15f991e6ed86c37fbc757abf88194d619065b55a633287afa2dd686aac0d3cdab803545580d08d
7
+ data.tar.gz: 6ef6f27d740b44717ed185013faccfc7d75f963dec165b2e7befc6c41e993fc54ef681691d4f1f969ff35e6852d4831fcf6cec6ce30fffdf2032101e91af2bd0
data/History.md CHANGED
@@ -1,42 +1,20 @@
1
- ## 6.4.3 / 2024-09-19
2
-
3
- * Security
4
- * Discards any headers using underscores if the non-underscore version also exists. Without this, an attacker could overwrite values set by intermediate proxies (e.g. X-Forwarded-For). ([CVE-2024-45614](https://github.com/puma/puma/security/advisories/GHSA-9hf4-67fc-4vf4)/GHSA-9hf4-67fc-4vf4)
5
-
6
- ## 6.4.2 / 2024-01-08
7
-
8
- * Security
9
- * Limit the size of chunk extensions. Without this limit, an attacker could cause unbounded resource (CPU, network bandwidth) consumption. ([GHSA-c2f4-cvqm-65w2](https://github.com/puma/puma/security/advisories/GHSA-c2f4-cvqm-65w2))
10
-
11
- ## 6.4.1 / 2024-01-03
1
+ ## 6.4.1 / 2023-10-18
12
2
 
13
3
  * Bugfixes
14
4
  * DSL#warn_if_in_single_mode - fixup when workers set via CLI ([#3256])
15
- * Fix `idle-timeout` not working in cluster mode ([#3235], [#3228], [#3282], [#3283])
5
+ * Fix `idle-timeout` not working in cluster mode ([#3235], [#3228])
16
6
  * Fix worker 0 timing out during phased restart ([#3225], [#2786])
17
7
  * context_builder.rb - require openssl if verify_mode != 'none' ([#3179])
18
- * Make puma cluster process suitable as PID 1 ([#3255])
19
- * Improve Puma::NullIO consistency with real IO ([#3276])
20
- * extconf.rb - fixup to detect openssl info in Ruby build ([#3271], [#3266])
21
- * MiniSSL.java - set serialVersionUID, fix RaiseException deprecation ([#3270])
22
- * dsl.rb - fix warn_if_in_single_mode when WEB_CONCURRENCY is set ([#3265], [#3264])
8
+ * Fix bug in tests re: TestPuma::HOST4 ([#3254])
23
9
 
24
10
  * Maintenance
25
11
  * LOTS of test refactoring to make tests more stable and easier to write - thanks to @MSP-Greg!
26
- * Fix bug in tests re: TestPuma::HOST4 ([#3254])
27
- * Dockerfile for minimal repros: use Ruby 3.2, expect bundler installed ([#3245])
28
- * fix define_method calls, use Symbol parameter instead of String ([#3293])
29
-
30
- * Docs
31
- * README.md - add the puma-acme plugin ([#3301])
32
- * Remove `--keep-file-descriptors` flag from systemd docs ([#3248])
33
- * Note symlink mechanism in restart documentation for hot restart ([#3298])
34
12
 
35
13
  ## 6.4.0 / 2023-09-21
36
14
 
37
15
  * Features
38
16
  * on_thread_exit hook ([#2920])
39
- * on_thread_start_hook ([#3195])
17
+ * on_thread_start_hook ([#3195])
40
18
  * Shutdown on idle ([#3209], [#2580])
41
19
  * New error message when control server port taken ([#3204])
42
20
 
@@ -46,13 +24,13 @@
46
24
 
47
25
  * Bugfixes
48
26
  * Bring the cert_pem: parameter into parity with the cert: parameter to ssl_bind. ([#3174])
49
- * Fix using control server with IPv6 host ([#3181])
27
+ * Fix using control server with IPv6 host ([#3181])
50
28
  * control_cli.rb - add require_relative 'log_writer' ([#3187])
51
29
  * Fix cases where fallback Rack response wasn't sent to the client ([#3094])
52
-
30
+
53
31
  ## 6.3.1 / 2023-08-18
54
32
 
55
- * Security
33
+ * Security
56
34
  * Address HTTP request smuggling vulnerabilities with zero-length Content Length header and trailer fields ([GHSA-68xg-gqqm-vgj8](https://github.com/puma/puma/security/advisories/GHSA-68xg-gqqm-vgj8))
57
35
 
58
36
  ## 6.3.0 / 2023-05-31
@@ -126,12 +104,12 @@
126
104
  * Refactor const.rb - freeze ([#3016])
127
105
 
128
106
  ## 6.0.1 / 2022-12-20
129
-
107
+
130
108
  * Bugfixes
131
109
  * Handle waking up a closed selector in Reactor#add ([#3005])
132
110
  * Fixup response processing, enumerable bodies ([#3004], [#3000])
133
111
  * Correctly close app body for all code paths ([#3002], [#2999])
134
- * Refactor
112
+ * Refactor
135
113
  * Add IOBuffer to Client, remove from ThreadPool thread instances ([#3013])
136
114
 
137
115
  ## 6.0.0 / 2022-10-14
@@ -160,12 +138,12 @@
160
138
  * Allow header values to be arrays (Rack 3) ([#2936], [#2931])
161
139
  * Export Puma/Ruby versions in /stats ([#2875])
162
140
  * Allow configuring request uri max length & request path max length ([#2840])
163
- * Add a couple of public accessors ([#2774])
141
+ * Add a couple of public accessors ([#2774])
164
142
  * Log entire backtrace when worker start fails ([#2891])
165
143
  * [jruby] Enable TLSv1.3 support ([#2886])
166
144
  * [jruby] support setting TLS protocols + rename ssl_cipher_list ([#2899])
167
145
  * [jruby] Support a truststore option ([#2849], [#2904], [#2884])
168
-
146
+
169
147
  * Bugfixes
170
148
  * Load the configuration before passing it to the binder ([#2897])
171
149
  * Do not raise error raised on HTTP methods we don't recognize or support, like CONNECT ([#2932], [#1441])
@@ -178,22 +156,9 @@
178
156
  * Ruby 3.2 will have native IO#wait_* methods, don't require io/wait ([#2903])
179
157
  * Various internal API refactorings ([#2942], [#2921], [#2922], [#2955])
180
158
 
181
- ## 5.6.9 / 2024-09-19
182
-
183
- * Security
184
- * Discards any headers using underscores if the non-underscore version also exists. Without this, an attacker could overwrite values set by intermediate proxies (e.g. X-Forwarded-For). ([CVE-2024-45614](https://github.com/puma/puma/security/advisories/GHSA-9hf4-67fc-4vf4)/GHSA-9hf4-67fc-4vf4)
185
- * JRuby
186
- * Must use at least Java >= 9 to compile. You can no longer build from source on Java 8.
187
-
188
-
189
- ## 5.6.8 / 2024-01-08
190
-
191
- * Security
192
- * Limit the size of chunk extensions. Without this limit, an attacker could cause unbounded resource (CPU, network bandwidth) consumption. ([GHSA-c2f4-cvqm-65w2](https://github.com/puma/puma/security/advisories/GHSA-c2f4-cvqm-65w2))
193
-
194
159
  ## 5.6.7 / 2023-08-18
195
160
 
196
- * Security
161
+ * Security
197
162
  * Address HTTP request smuggling vulnerabilities with zero-length Content Length header and trailer fields ([GHSA-68xg-gqqm-vgj8](https://github.com/puma/puma/security/advisories/GHSA-68xg-gqqm-vgj8))
198
163
 
199
164
  ## 5.6.6 / 2023-06-21
@@ -2079,24 +2044,10 @@ be added back in a future date when a java Puma::MiniSSL is added.
2079
2044
  [#3256]:https://github.com/puma/puma/pull/3256 "PR by @MSP-Greg, merged 2023-10-16"
2080
2045
  [#3235]:https://github.com/puma/puma/pull/3235 "PR by @joshuay03, merged 2023-10-03"
2081
2046
  [#3228]:https://github.com/puma/puma/issues/3228 "Issue by @davidalejandroaguilar, closed 2023-10-03"
2082
- [#3282]:https://github.com/puma/puma/issues/3282 "Issue by @bensheldon, closed 2024-01-02"
2083
- [#3283]:https://github.com/puma/puma/pull/3283 "PR by @joshuay03, merged 2024-01-02"
2084
2047
  [#3225]:https://github.com/puma/puma/pull/3225 "PR by @joshuay03, merged 2023-09-27"
2085
2048
  [#2786]:https://github.com/puma/puma/issues/2786 "Issue by @vitiokss, closed 2023-09-27"
2086
2049
  [#3179]:https://github.com/puma/puma/pull/3179 "PR by @MSP-Greg, merged 2023-09-26"
2087
- [#3255]:https://github.com/puma/puma/pull/3255 "PR by @casperisfine, merged 2023-10-19"
2088
- [#3276]:https://github.com/puma/puma/pull/3276 "PR by @casperisfine, merged 2023-11-16"
2089
- [#3271]:https://github.com/puma/puma/pull/3271 "PR by @MSP-Greg, merged 2023-10-30"
2090
- [#3266]:https://github.com/puma/puma/issues/3266 "Issue by @Dragonicity, closed 2023-10-30"
2091
- [#3270]:https://github.com/puma/puma/pull/3270 "PR by @MSP-Greg, merged 2023-10-30"
2092
- [#3265]:https://github.com/puma/puma/pull/3265 "PR by @MSP-Greg, merged 2023-10-25"
2093
- [#3264]:https://github.com/puma/puma/issues/3264 "Issue by @dentarg, closed 2023-10-25"
2094
2050
  [#3254]:https://github.com/puma/puma/pull/3254 "PR by @casperisfine, merged 2023-10-11"
2095
- [#3245]:https://github.com/puma/puma/pull/3245 "PR by @olleolleolle, merged 2023-10-02"
2096
- [#3293]:https://github.com/puma/puma/pull/3293 "PR by @MSP-Greg, merged 2023-12-21"
2097
- [#3301]:https://github.com/puma/puma/pull/3301 "PR by @benburkert, merged 2023-12-29"
2098
- [#3248]:https://github.com/puma/puma/pull/3248 "PR by @dentarg, merged 2023-10-04"
2099
- [#3298]:https://github.com/puma/puma/pull/3298 "PR by @til, merged 2023-12-26"
2100
2051
  [#2920]:https://github.com/puma/puma/pull/2920 "PR by @biinari, merged 2023-07-11"
2101
2052
  [#3195]:https://github.com/puma/puma/pull/3195 "PR by @binarygit, merged 2023-08-15"
2102
2053
  [#3209]:https://github.com/puma/puma/pull/3209 "PR by @joshuay03, merged 2023-09-04"
@@ -2281,7 +2232,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2281
2232
  [#2563]:https://github.com/puma/puma/pull/2563 "PR by @MSP-Greg, merged 2021-03-06"
2282
2233
  [#2504]:https://github.com/puma/puma/issues/2504 "Issue by @fsateler, closed 2021-03-06"
2283
2234
  [#2591]:https://github.com/puma/puma/pull/2591 "PR by @MSP-Greg, merged 2021-05-05"
2284
- [#2572]:https://github.com/puma/puma/issues/2572 "Issue by @josef-krabath, closed 2021-05-05"
2235
+ [#2572]:https://github.com/puma/puma/issues/2572 "Issue by @josefbilendo, closed 2021-05-05"
2285
2236
  [#2613]:https://github.com/puma/puma/pull/2613 "PR by @smcgivern, merged 2021-04-27"
2286
2237
  [#2605]:https://github.com/puma/puma/pull/2605 "PR by @pascalbetz, merged 2021-04-26"
2287
2238
  [#2584]:https://github.com/puma/puma/issues/2584 "Issue by @kaorihinata, closed 2021-04-26"
@@ -2597,7 +2548,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2597
2548
  [#1110]:https://github.com/puma/puma/pull/1110 "PR by @montdidier, merged 2016-12-12"
2598
2549
  [#1135]:https://github.com/puma/puma/pull/1135 "PR by @jkraemer, merged 2016-11-19"
2599
2550
  [#1081]:https://github.com/puma/puma/pull/1081 "PR by @frodsan, merged 2016-09-08"
2600
- [#1138]:https://github.com/puma/puma/pull/1138 "PR by @skull-squadron, merged 2016-12-13"
2551
+ [#1138]:https://github.com/puma/puma/pull/1138 "PR by @steakknife, merged 2016-12-13"
2601
2552
  [#1118]:https://github.com/puma/puma/pull/1118 "PR by @hiroara, merged 2016-11-20"
2602
2553
  [#1075]:https://github.com/puma/puma/issues/1075 "Issue by @pvalena, closed 2016-09-06"
2603
2554
  [#932]:https://github.com/puma/puma/issues/932 "Issue by @everplays, closed 2016-07-24"
data/README.md CHANGED
@@ -12,7 +12,7 @@ Puma is a **simple, fast, multi-threaded, and highly parallel HTTP 1.1 server fo
12
12
 
13
13
  ## Built For Speed & Parallelism
14
14
 
15
- Puma is a server for [Rack](https://github.com/rack/rack)-powered HTTP applications written in Ruby. It is:
15
+ Puma is a server for [Rack](https://github.com/rack/rack)-powered HTTP applications written in Ruby. It is:
16
16
  * **Multi-threaded**. Each request is served in a separate thread. This helps you serve more requests per second with less memory use.
17
17
  * **Multi-process**. "Pre-forks" in cluster mode, using less memory per-process thanks to copy-on-write memory.
18
18
  * **Standalone**. With SSL support, zero-downtime rolling restarts and a built-in request bufferer, you can deploy Puma without any reverse proxy.
@@ -138,93 +138,51 @@ preload_app!
138
138
 
139
139
  Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and preloading copies the code of master into the workers.
140
140
 
141
- #### Clustered mode hooks
142
-
143
- When using clustered mode, Puma's configuration DSL provides `before_fork` and `on_worker_boot`
144
- hooks to run code when the master process forks and child workers are booted respectively.
145
-
146
- It is recommended to use these hooks with `preload_app!`, otherwise constants loaded by your
147
- application (such as `Rails`) will not be available inside the hooks.
141
+ When using clustered mode, you can specify a block in your configuration file that will be run on boot of each worker:
148
142
 
149
143
  ```ruby
150
144
  # config/puma.rb
151
- before_fork do
152
- # Add code to run inside the Puma master process before it forks a worker child.
153
- end
154
-
155
145
  on_worker_boot do
156
- # Add code to run inside the Puma worker process after forking.
146
+ # configuration here
157
147
  end
158
148
  ```
159
149
 
160
- In addition, there is an `on_refork` hook which is used only in [`fork_worker` mode](docs/fork_worker.md),
161
- when the worker 0 child process forks a grandchild worker:
150
+ This code can be used to setup the process before booting the application, allowing
151
+ you to do some Puma-specific things that you don't want to embed in your application.
152
+ For instance, you could fire a log notification that a worker booted or send something to statsd. This can be called multiple times.
153
+
154
+ Constants loaded by your application (such as `Rails`) will not be available in `on_worker_boot`
155
+ unless preloading is enabled.
156
+
157
+ You can also specify a block to be run before workers are forked, using `before_fork`:
162
158
 
163
159
  ```ruby
164
- on_refork do
165
- # Used only when fork_worker mode is enabled. Add code to run inside the Puma worker 0
166
- # child process before it forks a grandchild worker.
160
+ # config/puma.rb
161
+ before_fork do
162
+ # configuration here
167
163
  end
168
164
  ```
169
165
 
170
- Importantly, note the following considerations when Ruby forks a child process:
171
-
172
- 1. File descriptors such as network sockets **are** copied from the parent to the forked
173
- child process. Dual-use of the same sockets by parent and child will result in I/O conflicts
174
- such as `SocketError`, `Errno::EPIPE`, and `EOFError`.
175
- 2. Background Ruby threads, including threads used by various third-party gems for connection
176
- monitoring, etc., are **not** copied to the child process. Often this does not cause
177
- immediate problems until a third-party connection goes down, at which point there will
178
- be no supervisor to reconnect it.
179
-
180
- Therefore, we recommend the following:
181
-
182
- 1. If possible, do not establish any socket connections (HTTP, database connections, etc.)
183
- inside Puma's master process when booting.
184
- 2. If (1) is not possible, use `before_fork` and `on_refork` to disconnect the parent's socket
185
- connections when forking, so that they are not accidentally copied to the child process.
186
- 3. Use `on_worker_boot` to restart any background threads on the forked child.
187
-
188
- #### Master process lifecycle hooks
189
-
190
- Puma's configuration DSL provides master process lifecycle hooks `on_booted`, `on_restart`, and `on_stopped`
191
- which may be used to specify code blocks to run on each event:
166
+ You can also specify a block to be run after puma is booted using `on_booted`:
192
167
 
193
168
  ```ruby
194
169
  # config/puma.rb
195
170
  on_booted do
196
- # Add code to run in the Puma master process after it boots,
197
- # and also after a phased restart completes.
198
- end
199
-
200
- on_restart do
201
- # Add code to run in the Puma master process when it receives
202
- # a restart command but before it restarts.
203
- end
204
-
205
- on_stopped do
206
- # Add code to run in the Puma master process when it receives
207
- # a stop command but before it shuts down.
171
+ # configuration here
208
172
  end
209
173
  ```
210
174
 
211
175
  ### Error handling
212
176
 
213
- If Puma encounters an error outside of the context of your application, it will respond with a 400/500 and a simple
177
+ If puma encounters an error outside of the context of your application, it will respond with a 500 and a simple
214
178
  textual error message (see `Puma::Server#lowlevel_error` or [server.rb](https://github.com/puma/puma/blob/master/lib/puma/server.rb)).
215
179
  You can specify custom behavior for this scenario. For example, you can report the error to your third-party
216
180
  error-tracking service (in this example, [rollbar](https://rollbar.com)):
217
181
 
218
182
  ```ruby
219
- lowlevel_error_handler do |e, env, status|
220
- if status == 400
221
- message = "The server could not process the request due to an error, such as an incorrectly typed URL, malformed syntax, or a URL that contains illegal characters.\n"
222
- else
223
- message = "An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact support@example.com\n"
224
- Rollbar.critical(e)
225
- end
226
-
227
- [status, {}, [message]]
183
+ lowlevel_error_handler do |e|
184
+ Rollbar.critical(e)
185
+ [500, {}, ["An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact support@example.com\n"]]
228
186
  end
229
187
  ```
230
188
 
@@ -291,7 +249,7 @@ $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.
291
249
 
292
250
  #### Controlling SSL Cipher Suites
293
251
 
294
- To use or avoid specific SSL ciphers for TLSv1.2 and below, use `ssl_cipher_filter` or `ssl_cipher_list` options.
252
+ To use or avoid specific SSL cipher suites, use `ssl_cipher_filter` or `ssl_cipher_list` options.
295
253
 
296
254
  ##### Ruby:
297
255
 
@@ -305,14 +263,6 @@ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_cipher_fil
305
263
  $ puma -b 'ssl://127.0.0.1:9292?keystore=path_to_keystore&keystore-pass=keystore_password&ssl_cipher_list=TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA'
306
264
  ```
307
265
 
308
- To configure the available TLSv1.3 ciphersuites, use `ssl_ciphersuites` option (not available for JRuby).
309
-
310
- ##### Ruby:
311
-
312
- ```
313
- $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_ciphersuites=TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256'
314
- ```
315
-
316
266
  See https://www.openssl.org/docs/man1.1.1/man1/ciphers.html for cipher filter format and full list of cipher suites.
317
267
 
318
268
  Disable TLS v1 with the `no_tlsv1` option:
@@ -329,7 +279,7 @@ To enable verification flags offered by OpenSSL, use `verification_flags` (not a
329
279
  $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN'
330
280
  ```
331
281
 
332
- You can also set multiple verification flags (by separating them with a comma):
282
+ You can also set multiple verification flags (by separating them with coma):
333
283
 
334
284
  ```
335
285
  $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN,CRL_CHECK'
@@ -460,7 +410,6 @@ Community guides:
460
410
  * [puma-plugin-statsd](https://github.com/yob/puma-plugin-statsd) — send Puma metrics to statsd
461
411
  * [puma-plugin-systemd](https://github.com/sj26/puma-plugin-systemd) — deeper integration with systemd for notify, status and watchdog. Puma 5.1.0 integrated notify and watchdog, which probably conflicts with this plugin. Puma 6.1.0 added status support which obsoletes the plugin entirely.
462
412
  * [puma-plugin-telemetry](https://github.com/babbel/puma-plugin-telemetry) - telemetry plugin for Puma offering various targets to publish
463
- * [puma-acme](https://github.com/anchordotdev/puma-acme) - automatic SSL/HTTPS certificate provisioning and setup
464
413
 
465
414
  ### Monitoring
466
415
 
data/docs/fork_worker.md CHANGED
@@ -22,14 +22,10 @@ The `fork_worker` option allows your application to be initialized only once for
22
22
 
23
23
  You can trigger a refork by sending the cluster the `SIGURG` signal or running the `pumactl refork` command at any time. A refork will also automatically trigger once, after a certain number of requests have been processed by worker 0 (default 1000). To configure the number of requests before the auto-refork, pass a positive integer argument to `fork_worker` (e.g., `fork_worker 1000`), or `0` to disable.
24
24
 
25
- ### Usage Considerations
26
-
27
- - `fork_worker` introduces a new `on_refork` configuration hook. If you were using the `before_fork` hook previously, we generally recommend to copy its logic to `on_refork`. Note that `fork_worker` triggers the `before_fork` configuration hook *only* when initially forking the master process to worker 0, and triggers the `on_refork` hook on all subsequent forks from worker 0 to additional workers.
28
-
29
25
  ### Limitations
30
26
 
31
27
  - This mode is still very experimental so there may be bugs or edge-cases, particularly around expected behavior of existing hooks. Please open a [bug report](https://github.com/puma/puma/issues/new?template=bug_report.md) if you encounter any issues.
32
28
 
33
29
  - In order to fork new workers cleanly, worker 0 shuts down its server and stops serving requests so there are no open file descriptors or other kinds of shared global state between processes, and to maximize copy-on-write efficiency across the newly-forked workers. This may temporarily reduce total capacity of the cluster during a phased restart / refork.
34
30
 
35
- - In a cluster with `n` workers, a normal phased restart stops and restarts workers one by one while the application is loaded in each process, so `n-1` workers are available serving requests during the restart. In a phased restart in fork-worker mode, the application is first loaded in worker 0 while `n-1` workers are available, then worker 0 remains stopped while the rest of the workers are reloaded one by one, leaving only `n-2` workers to be available for a brief period of time. Reloading the rest of the workers should be quick because the application is preloaded at that point, but there may be situations where it can take longer (slow clients, long-running application code, slow worker-fork hooks, etc).
31
+ In a cluster with `n` workers, a normal phased restart stops and restarts workers one by one while the application is loaded in each process, so `n-1` workers are available serving requests during the restart. In a phased restart in fork-worker mode, the application is first loaded in worker 0 while `n-1` workers are available, then worker 0 remains stopped while the rest of the workers are reloaded one by one, leaving only `n-2` workers to be available for a brief period of time. Reloading the rest of the workers should be quick because the application is preloaded at that point, but there may be situations where it can take longer (slow clients, long-running application code, slow worker-fork hooks, etc).
data/docs/restart.md CHANGED
@@ -27,7 +27,6 @@ Any of the following will cause a Puma server to perform a hot restart:
27
27
 
28
28
  ### Additional notes
29
29
 
30
- * The newly started Puma process changes its current working directory to the directory specified by the `directory` option. If `directory` is set to symlink, this is automatically re-evaluated, so this mechanism can be used to upgrade the application.
31
30
  * Only one version of the application is running at a time.
32
31
  * `on_restart` is invoked just before the server shuts down. This can be used to clean up resources (like long-lived database connections) gracefully. Since Ruby 2.0, it is not typically necessary to explicitly close file descriptors on restart. This is because any file descriptor opened by Ruby will have the `FD_CLOEXEC` flag set, meaning that file descriptors are closed on `exec`. `on_restart` is useful, though, if your application needs to perform any more graceful protocol-specific shutdown procedures before closing connections.
33
32
 
data/docs/signals.md CHANGED
@@ -17,13 +17,13 @@ $ ps aux | grep tail
17
17
  schneems 87152 0.0 0.0 2432772 492 s032 S+ 12:46PM 0:00.00 tail -f my.log
18
18
  ```
19
19
 
20
- You can send a signal in Ruby using the [Process module](https://ruby-doc.org/3.2.2/Process.html#method-c-kill):
20
+ You can send a signal in Ruby using the [Process module](https://www.ruby-doc.org/core-2.1.1/Process.html#kill-method):
21
21
 
22
22
  ```
23
23
  $ irb
24
24
  > puts pid
25
25
  => 87152
26
- Process.detach(pid) # https://ruby-doc.org/3.2.2/Process.html#method-c-detach
26
+ Process.detach(pid) # https://ruby-doc.org/core-2.1.1/Process.html#method-c-detach
27
27
  Process.kill("TERM", pid)
28
28
  ```
29
29
 
data/docs/systemd.md CHANGED
@@ -99,11 +99,9 @@ ListenStream=0.0.0.0:9293
99
99
  # ListenStream=/run/puma.sock
100
100
 
101
101
  # Socket options matching Puma defaults
102
+ NoDelay=true
102
103
  ReusePort=true
103
104
  Backlog=1024
104
- # Enable this if you're using Puma with the "low_latency" option, read more in Puma DSL docs and systemd docs:
105
- # https://www.freedesktop.org/software/systemd/man/latest/systemd.socket.html#NoDelay=
106
- # NoDelay=true
107
105
 
108
106
  [Install]
109
107
  WantedBy=sockets.target
@@ -241,13 +239,6 @@ cap $stage puma:start --dry-run
241
239
  cap $stage puma:stop --dry-run
242
240
  ~~~~
243
241
 
244
- ### Disabling Puma Systemd Integration
245
-
246
- If you would like to disable Puma's systemd integration, for example if you handle it elsewhere
247
- in your code yourself, simply set the the environment variable `PUMA_SKIP_SYSTEMD` to any value.
248
-
249
-
250
-
251
242
  [Restart]: https://www.freedesktop.org/software/systemd/man/systemd.service.html#Restart=
252
243
  [#1367]: https://github.com/puma/puma/issues/1367
253
244
  [#1499]: https://github.com/puma/puma/issues/1499
@@ -10,13 +10,14 @@ end
10
10
 
11
11
  unless ENV["PUMA_DISABLE_SSL"]
12
12
  # don't use pkg_config('openssl') if '--with-openssl-dir' is used
13
- has_openssl_dir = dir_config('openssl').any? ||
14
- RbConfig::CONFIG['configure_args']&.include?('openssl')
15
-
16
- found_pkg_config = !has_openssl_dir && pkg_config('openssl')
13
+ has_openssl_dir = dir_config('openssl').any?
14
+ # macOS TruffleRuby problem
15
+ found_pkg_config = RUBY_ENGINE == 'truffleruby' &&
16
+ RUBY_PLATFORM.include?('darwin') && ENV['GITHUB_ACTIONS'] == 'true' ?
17
+ false : !has_openssl_dir && pkg_config('openssl')
17
18
 
18
19
  found_ssl = if !$mingw && found_pkg_config
19
- puts '──── Using OpenSSL pkgconfig (openssl.pc) ────'
20
+ puts 'using OpenSSL pkgconfig (openssl.pc)'
20
21
  true
21
22
  elsif have_library('libcrypto', 'BIO_read') && have_library('libssl', 'SSL_CTX_new')
22
23
  true
@@ -31,27 +32,22 @@ unless ENV["PUMA_DISABLE_SSL"]
31
32
  if found_ssl
32
33
  have_header "openssl/bio.h"
33
34
 
34
- ssl_h = "openssl/ssl.h".freeze
35
-
36
- puts "\n──── Below are yes for 1.0.2 & later ────"
37
- have_func "DTLS_method" , ssl_h
38
- have_func "SSL_CTX_set_session_cache_mode(NULL, 0)", ssl_h
39
-
40
- puts "\n──── Below are yes for 1.1.0 & later ────"
41
- have_func "TLS_server_method" , ssl_h
42
- have_func "SSL_CTX_set_min_proto_version(NULL, 0)" , ssl_h
35
+ # below is yes for 1.0.2 & later
36
+ have_func "DTLS_method" , "openssl/ssl.h"
37
+ have_func "SSL_CTX_set_session_cache_mode(NULL, 0)", "openssl/ssl.h"
43
38
 
44
- puts "\n──── Below is yes for 1.1.0 and later, but isn't documented until 3.0.0 ────"
45
- # https://github.com/openssl/openssl/blob/OpenSSL_1_1_0/include/openssl/ssl.h#L1159
46
- have_func "SSL_CTX_set_dh_auto(NULL, 0)" , ssl_h
39
+ # below are yes for 1.1.0 & later
40
+ have_func "TLS_server_method" , "openssl/ssl.h"
41
+ have_func "SSL_CTX_set_min_proto_version(NULL, 0)" , "openssl/ssl.h"
47
42
 
48
- puts "\n──── Below is yes for 1.1.1 & later ────"
49
- have_func "SSL_CTX_set_ciphersuites(NULL, \"\")" , ssl_h
43
+ have_func "X509_STORE_up_ref"
44
+ have_func "SSL_CTX_set_ecdh_auto(NULL, 0)" , "openssl/ssl.h"
50
45
 
51
- puts "\n──── Below is yes for 3.0.0 & later ────"
52
- have_func "SSL_get1_peer_certificate" , ssl_h
46
+ # below exists in 1.1.0 and later, but isn't documented until 3.0.0
47
+ have_func "SSL_CTX_set_dh_auto(NULL, 0)" , "openssl/ssl.h"
53
48
 
54
- puts ''
49
+ # below is yes for 3.0.0 & later
50
+ have_func "SSL_get1_peer_certificate" , "openssl/ssl.h"
55
51
 
56
52
  # Random.bytes available in Ruby 2.5 and later, Random::DEFAULT deprecated in 3.0
57
53
  if Random.respond_to?(:bytes)
@@ -229,7 +229,7 @@ VALUE
229
229
  sslctx_initialize(VALUE self, VALUE mini_ssl_ctx) {
230
230
  SSL_CTX* ctx;
231
231
  int ssl_options;
232
- VALUE key, cert, ca, verify_mode, ssl_cipher_filter, ssl_ciphersuites, no_tlsv1, no_tlsv1_1,
232
+ VALUE key, cert, ca, verify_mode, ssl_cipher_filter, no_tlsv1, no_tlsv1_1,
233
233
  verification_flags, session_id_bytes, cert_pem, key_pem, key_password_command, key_password;
234
234
  BIO *bio;
235
235
  X509 *x509 = NULL;
@@ -269,8 +269,6 @@ sslctx_initialize(VALUE self, VALUE mini_ssl_ctx) {
269
269
 
270
270
  ssl_cipher_filter = rb_funcall(mini_ssl_ctx, rb_intern_const("ssl_cipher_filter"), 0);
271
271
 
272
- ssl_ciphersuites = rb_funcall(mini_ssl_ctx, rb_intern_const("ssl_ciphersuites"), 0);
273
-
274
272
  no_tlsv1 = rb_funcall(mini_ssl_ctx, rb_intern_const("no_tlsv1"), 0);
275
273
 
276
274
  no_tlsv1_1 = rb_funcall(mini_ssl_ctx, rb_intern_const("no_tlsv1_1"), 0);
@@ -446,14 +444,6 @@ sslctx_initialize(VALUE self, VALUE mini_ssl_ctx) {
446
444
  SSL_CTX_set_cipher_list(ctx, "HIGH:!aNULL@STRENGTH");
447
445
  }
448
446
 
449
- #if HAVE_SSL_CTX_SET_CIPHERSUITES
450
- // Only override OpenSSL default ciphersuites if config option is supplied.
451
- if (!NIL_P(ssl_ciphersuites)) {
452
- StringValue(ssl_ciphersuites);
453
- SSL_CTX_set_ciphersuites(ctx, RSTRING_PTR(ssl_ciphersuites));
454
- }
455
- #endif
456
-
457
447
  #if OPENSSL_VERSION_NUMBER < 0x10002000L
458
448
  // Remove this case if OpenSSL 1.0.1 (now EOL) support is no longer needed.
459
449
  ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
@@ -556,7 +546,7 @@ NORETURN(void raise_error(SSL* ssl, int result));
556
546
 
557
547
  void raise_error(SSL* ssl, int result) {
558
548
  char buf[512];
559
- char msg[768];
549
+ char msg[512];
560
550
  const char* err_str;
561
551
  int err = errno;
562
552
  int mask = 4095;
@@ -99,8 +99,6 @@ public class Http11 extends RubyObject {
99
99
  int bite = b.get(i) & 0xFF;
100
100
  if(bite == '-') {
101
101
  b.set(i, (byte)'_');
102
- } else if(bite == '_') {
103
- b.set(i, (byte)',');
104
102
  } else {
105
103
  b.set(i, (byte)Character.toUpperCase(bite));
106
104
  }
@@ -47,7 +47,6 @@ import static javax.net.ssl.SSLEngineResult.Status;
47
47
  import static javax.net.ssl.SSLEngineResult.HandshakeStatus;
48
48
 
49
49
  public class MiniSSL extends RubyObject { // MiniSSL::Engine
50
- private static final long serialVersionUID = -6903439483039141234L;
51
50
  private static ObjectAllocator ALLOCATOR = new ObjectAllocator() {
52
51
  public IRubyObject allocate(Ruby runtime, RubyClass klass) {
53
52
  return new MiniSSL(runtime, klass);
@@ -501,7 +500,7 @@ public class MiniSSL extends RubyObject { // MiniSSL::Engine
501
500
  }
502
501
 
503
502
  private static RaiseException newError(Ruby runtime, RubyClass errorClass, String message, Throwable cause) {
504
- RaiseException ex = RaiseException.from(runtime, errorClass, message);
503
+ RaiseException ex = new RaiseException(runtime, errorClass, message, true);
505
504
  ex.initCause(cause);
506
505
  return ex;
507
506
  }
@@ -461,9 +461,6 @@ void Init_mini_ssl(VALUE mod);
461
461
 
462
462
  void Init_puma_http11(void)
463
463
  {
464
- #ifdef HAVE_RB_EXT_RACTOR_SAFE
465
- rb_ext_ractor_safe(true);
466
- #endif
467
464
 
468
465
  VALUE mPuma = rb_define_module("Puma");
469
466
  VALUE cHttpParser = rb_define_class_under(mPuma, "HttpParser", rb_cObject);
data/lib/puma/binder.rb CHANGED
@@ -19,14 +19,13 @@ module Puma
19
19
 
20
20
  RACK_VERSION = [1,6].freeze
21
21
 
22
- def initialize(log_writer, conf = Configuration.new, env: ENV)
22
+ def initialize(log_writer, conf = Configuration.new)
23
23
  @log_writer = log_writer
24
24
  @conf = conf
25
25
  @listeners = []
26
26
  @inherited_fds = {}
27
27
  @activated_sockets = {}
28
28
  @unix_paths = []
29
- @env = env
30
29
 
31
30
  @proto_env = {
32
31
  "rack.version".freeze => RACK_VERSION,
@@ -35,7 +34,7 @@ module Puma
35
34
  "rack.multiprocess".freeze => conf.options[:workers] >= 1,
36
35
  "rack.run_once".freeze => false,
37
36
  RACK_URL_SCHEME => conf.options[:rack_url_scheme],
38
- "SCRIPT_NAME".freeze => env['SCRIPT_NAME'] || "",
37
+ "SCRIPT_NAME".freeze => ENV['SCRIPT_NAME'] || "",
39
38
 
40
39
  # I'd like to set a default CONTENT_TYPE here but some things
41
40
  # depend on their not being a default set and inferring
@@ -88,7 +87,7 @@ module Puma
88
87
  # @version 5.0.0
89
88
  #
90
89
  def create_activated_fds(env_hash)
91
- @log_writer.debug "ENV['LISTEN_FDS'] #{@env['LISTEN_FDS'].inspect} env_hash['LISTEN_PID'] #{env_hash['LISTEN_PID'].inspect}"
90
+ @log_writer.debug "ENV['LISTEN_FDS'] #{ENV['LISTEN_FDS'].inspect} env_hash['LISTEN_PID'] #{env_hash['LISTEN_PID'].inspect}"
92
91
  return [] unless env_hash['LISTEN_FDS'] && env_hash['LISTEN_PID'].to_i == $$
93
92
  env_hash['LISTEN_FDS'].to_i.times do |index|
94
93
  sock = TCPServer.for_fd(socket_activation_fd(index))
@@ -184,7 +183,7 @@ module Puma
184
183
  io = inherit_unix_listener path, fd
185
184
  log_writer.log "* Inherited #{str}"
186
185
  elsif sock = @activated_sockets.delete([ :unix, path ]) ||
187
- !abstract && @activated_sockets.delete([ :unix, File.realdirpath(path) ])
186
+ @activated_sockets.delete([ :unix, File.realdirpath(path) ])
188
187
  @unix_paths << path unless abstract || File.exist?(path)
189
188
  io = inherit_unix_listener path, sock
190
189
  log_writer.log "* Activated #{str}"
data/lib/puma/cli.rb CHANGED
@@ -24,7 +24,7 @@ module Puma
24
24
  # Create a new CLI object using +argv+ as the command line
25
25
  # arguments.
26
26
  #
27
- def initialize(argv, log_writer = LogWriter.stdio, events = Events.new, env: ENV)
27
+ def initialize(argv, log_writer = LogWriter.stdio, events = Events.new)
28
28
  @debug = false
29
29
  @argv = argv.dup
30
30
  @log_writer = log_writer
@@ -39,7 +39,7 @@ module Puma
39
39
  @control_url = nil
40
40
  @control_options = {}
41
41
 
42
- setup_options env
42
+ setup_options
43
43
 
44
44
  begin
45
45
  @parser.parse! @argv
@@ -63,7 +63,7 @@ module Puma
63
63
  end
64
64
  end
65
65
 
66
- @launcher = Puma::Launcher.new(@conf, env: ENV, log_writer: @log_writer, events: @events, argv: argv)
66
+ @launcher = Puma::Launcher.new(@conf, :log_writer => @log_writer, :events => @events, :argv => argv)
67
67
  end
68
68
 
69
69
  attr_reader :launcher
@@ -92,8 +92,8 @@ module Puma
92
92
  # Build the OptionParser object to handle the available options.
93
93
  #
94
94
 
95
- def setup_options(env = ENV)
96
- @conf = Configuration.new({}, {events: @events}, env) do |user_config, file_config|
95
+ def setup_options
96
+ @conf = Configuration.new({}, {events: @events}) do |user_config, file_config|
97
97
  @parser = OptionParser.new do |o|
98
98
  o.on "-b", "--bind URI", "URI to bind to (tcp://, unix://, ssl://)" do |arg|
99
99
  user_config.bind arg
@@ -157,10 +157,6 @@ module Puma
157
157
  user_config.pidfile arg
158
158
  end
159
159
 
160
- o.on "--plugin PLUGIN", "Load the given PLUGIN. Can be used multiple times to load multiple plugins." do |arg|
161
- user_config.plugin arg
162
- end
163
-
164
160
  o.on "--preload", "Preload the app. Cluster mode only" do
165
161
  user_config.preload_app!
166
162
  end