jun-puma 1.0.0-java → 1.0.2-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 +4 -4
- data/History.md +14 -63
- data/README.md +22 -73
- data/ext/puma_http11/extconf.rb +18 -22
- data/lib/puma/puma_http11.jar +0 -0
- metadata +8 -86
- data/bin/puma-wild +0 -25
- data/docs/architecture.md +0 -74
- data/docs/compile_options.md +0 -55
- data/docs/deployment.md +0 -102
- data/docs/fork_worker.md +0 -35
- data/docs/images/puma-connection-flow-no-reactor.png +0 -0
- data/docs/images/puma-connection-flow.png +0 -0
- data/docs/images/puma-general-arch.png +0 -0
- data/docs/jungle/README.md +0 -9
- data/docs/jungle/rc.d/README.md +0 -74
- data/docs/jungle/rc.d/puma +0 -61
- data/docs/jungle/rc.d/puma.conf +0 -10
- data/docs/kubernetes.md +0 -78
- data/docs/nginx.md +0 -80
- data/docs/plugins.md +0 -38
- data/docs/rails_dev_mode.md +0 -28
- data/docs/restart.md +0 -65
- data/docs/signals.md +0 -98
- data/docs/stats.md +0 -142
- data/docs/systemd.md +0 -253
- data/docs/testing_benchmarks_local_files.md +0 -150
- data/docs/testing_test_rackup_ci_files.md +0 -36
- data/ext/puma_http11/PumaHttp11Service.java +0 -17
- data/ext/puma_http11/ext_help.h +0 -15
- data/ext/puma_http11/http11_parser.c +0 -1057
- data/ext/puma_http11/http11_parser.h +0 -65
- data/ext/puma_http11/http11_parser.java.rl +0 -145
- data/ext/puma_http11/http11_parser.rl +0 -149
- data/ext/puma_http11/http11_parser_common.rl +0 -54
- data/ext/puma_http11/mini_ssl.c +0 -842
- data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -15
- data/ext/puma_http11/org/jruby/puma/Http11.java +0 -228
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +0 -455
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +0 -509
- data/ext/puma_http11/puma_http11.c +0 -495
- data/lib/puma/app/status.rb +0 -96
- data/lib/puma/binder.rb +0 -502
- data/lib/puma/cli.rb +0 -247
- data/lib/puma/client.rb +0 -682
- data/lib/puma/cluster/worker.rb +0 -180
- data/lib/puma/cluster/worker_handle.rb +0 -96
- data/lib/puma/cluster.rb +0 -616
- data/lib/puma/commonlogger.rb +0 -115
- data/lib/puma/configuration.rb +0 -390
- data/lib/puma/const.rb +0 -307
- data/lib/puma/control_cli.rb +0 -316
- data/lib/puma/detect.rb +0 -45
- data/lib/puma/dsl.rb +0 -1425
- data/lib/puma/error_logger.rb +0 -113
- data/lib/puma/events.rb +0 -57
- data/lib/puma/io_buffer.rb +0 -46
- data/lib/puma/jruby_restart.rb +0 -11
- data/lib/puma/json_serialization.rb +0 -96
- data/lib/puma/launcher/bundle_pruner.rb +0 -104
- data/lib/puma/launcher.rb +0 -488
- data/lib/puma/log_writer.rb +0 -147
- data/lib/puma/minissl/context_builder.rb +0 -96
- data/lib/puma/minissl.rb +0 -459
- data/lib/puma/null_io.rb +0 -84
- data/lib/puma/plugin/systemd.rb +0 -90
- data/lib/puma/plugin/tmp_restart.rb +0 -36
- data/lib/puma/plugin.rb +0 -111
- data/lib/puma/rack/builder.rb +0 -297
- data/lib/puma/rack/urlmap.rb +0 -93
- data/lib/puma/rack_default.rb +0 -24
- data/lib/puma/reactor.rb +0 -125
- data/lib/puma/request.rb +0 -688
- data/lib/puma/runner.rb +0 -213
- data/lib/puma/sd_notify.rb +0 -149
- data/lib/puma/server.rb +0 -680
- data/lib/puma/single.rb +0 -69
- data/lib/puma/state_file.rb +0 -68
- data/lib/puma/thread_pool.rb +0 -434
- data/lib/puma/util.rb +0 -141
- data/lib/puma.rb +0 -78
- data/lib/rack/handler/puma.rb +0 -144
- data/tools/Dockerfile +0 -16
- data/tools/trickletest.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93729a2531af093dfe3a707a797c6937fc035fb41f48c23b66486e01f2c66b1c
|
4
|
+
data.tar.gz: 1d07eebd87f8f70834e7a208bbcd1ea9255b501e1405e7fd903e4c9055da2bca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b8f718c1105ba6d8586ab8f54c34810471580f11f3b7f6124dff04dbca5903025127e43a9df79fa3c68a507b30000cc31468c0428201a87156c4e758b81a32b
|
7
|
+
data.tar.gz: 123566fa15a0af5bbad37502698d04822d9a25ce2a91229dd4e5e6890fb50206fbb511ed6953578fe73edc54809e31cb79d8f581168460cb18a8c681010f1164
|
data/History.md
CHANGED
@@ -1,42 +1,20 @@
|
|
1
|
-
## 6.4.
|
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]
|
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
|
-
*
|
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 @
|
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 @
|
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
|
-
|
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
|
-
#
|
146
|
+
# configuration here
|
157
147
|
end
|
158
148
|
```
|
159
149
|
|
160
|
-
|
161
|
-
|
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
|
-
|
165
|
-
|
166
|
-
#
|
160
|
+
# config/puma.rb
|
161
|
+
before_fork do
|
162
|
+
# configuration here
|
167
163
|
end
|
168
164
|
```
|
169
165
|
|
170
|
-
|
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
|
-
#
|
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
|
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
|
220
|
-
|
221
|
-
|
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
|
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
|
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/ext/puma_http11/extconf.rb
CHANGED
@@ -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
|
-
|
15
|
-
|
16
|
-
|
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 '
|
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
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
45
|
-
|
46
|
-
have_func "
|
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
|
-
|
49
|
-
have_func "
|
43
|
+
have_func "X509_STORE_up_ref"
|
44
|
+
have_func "SSL_CTX_set_ecdh_auto(NULL, 0)" , "openssl/ssl.h"
|
50
45
|
|
51
|
-
|
52
|
-
have_func "
|
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
|
-
|
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)
|
data/lib/puma/puma_http11.jar
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jun-puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
@@ -17,18 +17,17 @@ dependencies:
|
|
17
17
|
- !ruby/object:Gem::Version
|
18
18
|
version: '2.0'
|
19
19
|
name: nio4r
|
20
|
-
prerelease: false
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
|
-
description:
|
28
|
-
Puma is
|
29
|
-
|
30
|
-
|
31
|
-
JRuby and TruffleRuby as well as as providing process worker support to support CRuby well.
|
27
|
+
description: Puma is a simple, fast, threaded, and highly parallel HTTP 1.1 server
|
28
|
+
for Ruby/Rack applications. Puma is intended for use in both development and production
|
29
|
+
environments. It's great for highly parallel Ruby implementations such as Rubinius
|
30
|
+
and JRuby as well as as providing process worker support to support CRuby well.
|
32
31
|
email:
|
33
32
|
- evan@phx.io
|
34
33
|
executables:
|
@@ -41,87 +40,9 @@ files:
|
|
41
40
|
- LICENSE
|
42
41
|
- README.md
|
43
42
|
- bin/puma
|
44
|
-
- bin/puma-wild
|
45
43
|
- bin/pumactl
|
46
|
-
- docs/architecture.md
|
47
|
-
- docs/compile_options.md
|
48
|
-
- docs/deployment.md
|
49
|
-
- docs/fork_worker.md
|
50
|
-
- docs/images/puma-connection-flow-no-reactor.png
|
51
|
-
- docs/images/puma-connection-flow.png
|
52
|
-
- docs/images/puma-general-arch.png
|
53
|
-
- docs/jungle/README.md
|
54
|
-
- docs/jungle/rc.d/README.md
|
55
|
-
- docs/jungle/rc.d/puma
|
56
|
-
- docs/jungle/rc.d/puma.conf
|
57
|
-
- docs/kubernetes.md
|
58
|
-
- docs/nginx.md
|
59
|
-
- docs/plugins.md
|
60
|
-
- docs/rails_dev_mode.md
|
61
|
-
- docs/restart.md
|
62
|
-
- docs/signals.md
|
63
|
-
- docs/stats.md
|
64
|
-
- docs/systemd.md
|
65
|
-
- docs/testing_benchmarks_local_files.md
|
66
|
-
- docs/testing_test_rackup_ci_files.md
|
67
|
-
- ext/puma_http11/PumaHttp11Service.java
|
68
|
-
- ext/puma_http11/ext_help.h
|
69
44
|
- ext/puma_http11/extconf.rb
|
70
|
-
- ext/puma_http11/http11_parser.c
|
71
|
-
- ext/puma_http11/http11_parser.h
|
72
|
-
- ext/puma_http11/http11_parser.java.rl
|
73
|
-
- ext/puma_http11/http11_parser.rl
|
74
|
-
- ext/puma_http11/http11_parser_common.rl
|
75
|
-
- ext/puma_http11/mini_ssl.c
|
76
|
-
- ext/puma_http11/no_ssl/PumaHttp11Service.java
|
77
|
-
- ext/puma_http11/org/jruby/puma/Http11.java
|
78
|
-
- ext/puma_http11/org/jruby/puma/Http11Parser.java
|
79
|
-
- ext/puma_http11/org/jruby/puma/MiniSSL.java
|
80
|
-
- ext/puma_http11/puma_http11.c
|
81
|
-
- lib/puma.rb
|
82
|
-
- lib/puma/app/status.rb
|
83
|
-
- lib/puma/binder.rb
|
84
|
-
- lib/puma/cli.rb
|
85
|
-
- lib/puma/client.rb
|
86
|
-
- lib/puma/cluster.rb
|
87
|
-
- lib/puma/cluster/worker.rb
|
88
|
-
- lib/puma/cluster/worker_handle.rb
|
89
|
-
- lib/puma/commonlogger.rb
|
90
|
-
- lib/puma/configuration.rb
|
91
|
-
- lib/puma/const.rb
|
92
|
-
- lib/puma/control_cli.rb
|
93
|
-
- lib/puma/detect.rb
|
94
|
-
- lib/puma/dsl.rb
|
95
|
-
- lib/puma/error_logger.rb
|
96
|
-
- lib/puma/events.rb
|
97
|
-
- lib/puma/io_buffer.rb
|
98
|
-
- lib/puma/jruby_restart.rb
|
99
|
-
- lib/puma/json_serialization.rb
|
100
|
-
- lib/puma/launcher.rb
|
101
|
-
- lib/puma/launcher/bundle_pruner.rb
|
102
|
-
- lib/puma/log_writer.rb
|
103
|
-
- lib/puma/minissl.rb
|
104
|
-
- lib/puma/minissl/context_builder.rb
|
105
|
-
- lib/puma/null_io.rb
|
106
|
-
- lib/puma/plugin.rb
|
107
|
-
- lib/puma/plugin/systemd.rb
|
108
|
-
- lib/puma/plugin/tmp_restart.rb
|
109
45
|
- lib/puma/puma_http11.jar
|
110
|
-
- lib/puma/rack/builder.rb
|
111
|
-
- lib/puma/rack/urlmap.rb
|
112
|
-
- lib/puma/rack_default.rb
|
113
|
-
- lib/puma/reactor.rb
|
114
|
-
- lib/puma/request.rb
|
115
|
-
- lib/puma/runner.rb
|
116
|
-
- lib/puma/sd_notify.rb
|
117
|
-
- lib/puma/server.rb
|
118
|
-
- lib/puma/single.rb
|
119
|
-
- lib/puma/state_file.rb
|
120
|
-
- lib/puma/thread_pool.rb
|
121
|
-
- lib/puma/util.rb
|
122
|
-
- lib/rack/handler/puma.rb
|
123
|
-
- tools/Dockerfile
|
124
|
-
- tools/trickletest.rb
|
125
46
|
homepage: https://puma.io
|
126
47
|
licenses:
|
127
48
|
- BSD-3-Clause
|
@@ -149,5 +70,6 @@ requirements: []
|
|
149
70
|
rubygems_version: 3.3.26
|
150
71
|
signing_key:
|
151
72
|
specification_version: 4
|
152
|
-
summary:
|
73
|
+
summary: Puma is a simple, fast, threaded, and highly parallel HTTP 1.1 server for
|
74
|
+
Ruby/Rack applications
|
153
75
|
test_files: []
|
data/bin/puma-wild
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Copyright (c) 2014 Evan Phoenix
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
|
8
|
-
cli_arg = ARGV.shift
|
9
|
-
|
10
|
-
inc = ""
|
11
|
-
|
12
|
-
if cli_arg == "-I"
|
13
|
-
inc = ARGV.shift
|
14
|
-
$LOAD_PATH.concat inc.split(":")
|
15
|
-
end
|
16
|
-
|
17
|
-
module Puma; end
|
18
|
-
|
19
|
-
Puma.const_set(:WILD_ARGS, ["-I", inc])
|
20
|
-
|
21
|
-
require 'puma/cli'
|
22
|
-
|
23
|
-
cli = Puma::CLI.new ARGV
|
24
|
-
|
25
|
-
cli.run
|
data/docs/architecture.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Architecture
|
2
|
-
|
3
|
-
## Overview
|
4
|
-
|
5
|
-

|
6
|
-
|
7
|
-
Puma is a threaded Ruby HTTP application server processing requests across a TCP
|
8
|
-
and/or UNIX socket.
|
9
|
-
|
10
|
-
|
11
|
-
Puma processes (there can be one or many) accept connections from the socket via
|
12
|
-
a thread (in the [`Reactor`](../lib/puma/reactor.rb) class). The connection,
|
13
|
-
once fully buffered and read, moves into the `todo` list, where an available
|
14
|
-
thread will pick it up (in the [`ThreadPool`](../lib/puma/thread_pool.rb)
|
15
|
-
class).
|
16
|
-
|
17
|
-
Puma works in two main modes: cluster and single. In single mode, only one Puma
|
18
|
-
process boots. In cluster mode, a `master` process is booted, which prepares
|
19
|
-
(and may boot) the application and then uses the `fork()` system call to create
|
20
|
-
one or more `child` processes. These `child` processes all listen to the same
|
21
|
-
socket. The `master` process does not listen to the socket or process requests -
|
22
|
-
its purpose is primarily to manage and listen for UNIX signals and possibly kill
|
23
|
-
or boot `child` processes.
|
24
|
-
|
25
|
-
We sometimes call `child` processes (or Puma processes in `single` mode)
|
26
|
-
_workers_, and we sometimes call the threads created by Puma's
|
27
|
-
[`ThreadPool`](../lib/puma/thread_pool.rb) _worker threads_.
|
28
|
-
|
29
|
-
## How Requests Work
|
30
|
-
|
31
|
-

|
32
|
-
|
33
|
-
* Upon startup, Puma listens on a TCP or UNIX socket.
|
34
|
-
* The backlog of this socket is configured with a default of 1024, but the
|
35
|
-
actual backlog value is capped by the `net.core.somaxconn` sysctl value.
|
36
|
-
The backlog determines the size of the queue for unaccepted connections. If
|
37
|
-
the backlog is full, the operating system is not accepting new connections.
|
38
|
-
* This socket backlog is distinct from the `backlog` of work as reported by
|
39
|
-
`Puma.stats` or the control server. The backlog that `Puma.stats` refers to
|
40
|
-
represents the number of connections in the process' `todo` set waiting for
|
41
|
-
a thread from the [`ThreadPool`](../lib/puma/thread_pool.rb).
|
42
|
-
* By default, a single, separate thread (created by the
|
43
|
-
[`Reactor`](../lib/puma/reactor.rb) class) reads and buffers requests from the
|
44
|
-
socket.
|
45
|
-
* When at least one worker thread is available for work, the reactor thread
|
46
|
-
listens to the socket and accepts a request (if one is waiting).
|
47
|
-
* The reactor thread waits for the entire HTTP request to be received.
|
48
|
-
* Puma exposes the time spent waiting for the HTTP request body to be
|
49
|
-
received to the Rack app as `env['puma.request_body_wait']`
|
50
|
-
(milliseconds).
|
51
|
-
* Once fully buffered and received, the connection is pushed into the "todo"
|
52
|
-
set.
|
53
|
-
* Worker threads pop work off the "todo" set for processing.
|
54
|
-
* The worker thread processes the request via `call`ing the configured Rack
|
55
|
-
application. The Rack application generates the HTTP response.
|
56
|
-
* The worker thread writes the response to the connection. While Puma buffers
|
57
|
-
requests via a separate thread, it does not use a separate thread for
|
58
|
-
responses.
|
59
|
-
* Once done, the thread becomes available to process another connection in the
|
60
|
-
"todo" set.
|
61
|
-
|
62
|
-
### `queue_requests`
|
63
|
-
|
64
|
-

|
65
|
-
|
66
|
-
The `queue_requests` option is `true` by default, enabling the separate reactor
|
67
|
-
thread used to buffer requests as described above.
|
68
|
-
|
69
|
-
If set to `false`, this buffer will not be used for connections while waiting
|
70
|
-
for the request to arrive.
|
71
|
-
|
72
|
-
In this mode, when a connection is accepted, it is added to the "todo" queue
|
73
|
-
immediately, and a worker will synchronously do any waiting necessary to read
|
74
|
-
the HTTP request from the socket.
|