puma 5.3.2 → 5.6.9

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +216 -11
  3. data/README.md +47 -6
  4. data/docs/architecture.md +49 -16
  5. data/docs/compile_options.md +4 -2
  6. data/docs/deployment.md +53 -67
  7. data/docs/plugins.md +15 -15
  8. data/docs/rails_dev_mode.md +2 -3
  9. data/docs/restart.md +6 -6
  10. data/docs/signals.md +11 -10
  11. data/docs/stats.md +8 -8
  12. data/docs/systemd.md +64 -67
  13. data/ext/puma_http11/extconf.rb +34 -6
  14. data/ext/puma_http11/http11_parser.c +23 -10
  15. data/ext/puma_http11/http11_parser_common.rl +1 -1
  16. data/ext/puma_http11/mini_ssl.c +90 -12
  17. data/ext/puma_http11/org/jruby/puma/Http11.java +2 -0
  18. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +49 -47
  19. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +38 -55
  20. data/ext/puma_http11/puma_http11.c +1 -1
  21. data/lib/puma/app/status.rb +7 -4
  22. data/lib/puma/binder.rb +51 -6
  23. data/lib/puma/cli.rb +14 -4
  24. data/lib/puma/client.rb +143 -25
  25. data/lib/puma/cluster/worker.rb +8 -18
  26. data/lib/puma/cluster/worker_handle.rb +4 -0
  27. data/lib/puma/cluster.rb +30 -24
  28. data/lib/puma/configuration.rb +4 -1
  29. data/lib/puma/const.rb +17 -8
  30. data/lib/puma/control_cli.rb +19 -13
  31. data/lib/puma/detect.rb +8 -2
  32. data/lib/puma/dsl.rb +111 -13
  33. data/lib/puma/{json.rb → json_serialization.rb} +1 -1
  34. data/lib/puma/launcher.rb +15 -1
  35. data/lib/puma/minissl/context_builder.rb +8 -6
  36. data/lib/puma/minissl.rb +33 -27
  37. data/lib/puma/null_io.rb +5 -0
  38. data/lib/puma/plugin.rb +2 -2
  39. data/lib/puma/rack/builder.rb +1 -1
  40. data/lib/puma/request.rb +35 -13
  41. data/lib/puma/runner.rb +22 -8
  42. data/lib/puma/server.rb +37 -29
  43. data/lib/puma/state_file.rb +42 -7
  44. data/lib/puma/thread_pool.rb +7 -5
  45. data/lib/puma/util.rb +20 -4
  46. data/lib/puma.rb +6 -4
  47. data/lib/rack/version_restriction.rb +15 -0
  48. data/tools/Dockerfile +1 -1
  49. metadata +8 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f0d0f5c0a10e36659888cae94e428c91dbe06ba8e3842853b4d6cfd0b103603
4
- data.tar.gz: 7b375f89a704b081fba4eb08c52aec94563f0c6a888b9544ce0afcefc443b8fa
3
+ metadata.gz: 869ae34fc3a993b7bc996c0053a647afc12fb908e6d5224a841bdafb23974bef
4
+ data.tar.gz: e65a1e6e579b8c8b4d52a77ee9bf4710be1a26f5e4934f96d4502f2b1afa98af
5
5
  SHA512:
6
- metadata.gz: 14a0bde86f109197089905694c259d2382d86000ab877cb8eaf44c593866afdedad173d1c7c9eb1efe48a714ee33f6b5e4c3c32fe420d3298ab3511c9fae0a7a
7
- data.tar.gz: a31d4feee8e6a36c27d1037ad91cc279c294505ecbb143c3a005f7d0817031c9b80cef465b5800c6c6075f16f587e43fa98de8dd2b99fe92996c9c9fba36ea70
6
+ metadata.gz: b9e1cb266acced0292dc12e0b825344de6cf128a42246625bf166f8042497b75195d354cda77123c5ae8049d062465b58b19395d31cc922e32196072d94ad45c
7
+ data.tar.gz: 522578ae4fc289ff7bd2c71704e7c8b22dcf0bf59db414bc2d5a730243e6daac027d2f4b106e9913f881a53749c75b41fd5c77982b8bfca3768b62f25abde150
data/History.md CHANGED
@@ -1,14 +1,134 @@
1
+ ## 5.6.9 / 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
+ ## 5.6.8 / 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
+ ## 5.6.7 / 2023-08-18
12
+
13
+ * Security
14
+ * 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))
15
+
16
+ ## 5.6.6 / 2023-06-21
17
+
18
+ * Bugfix
19
+ * Allow Puma to be loaded with Rack 3 ([#3166])
20
+
21
+ ## 5.6.5 / 2022-08-23
22
+
23
+ * Feature
24
+ * Puma::ControlCLI - allow refork command to be sent as a request ([#2868], [#2866])
25
+
26
+ * Bugfixes
27
+ * NullIO#closed should return false ([#2883])
28
+ * [jruby] Fix TLS verification hang ([#2890], [#2729])
29
+ * extconf.rb - don't use pkg_config('openssl') if '--with-openssl-dir' is used ([#2885], [#2839])
30
+ * MiniSSL - detect SSL_CTX_set_dh_auto ([#2864], [#2863])
31
+ * Fix rack.after_reply exceptions breaking connections ([#2861], [#2856])
32
+ * Escape SSL cert and filenames ([#2855])
33
+ * Fail hard if SSL certs or keys are invalid ([#2848])
34
+ * Fail hard if SSL certs or keys cannot be read by user ([#2847])
35
+ * Fix build with Opaque DH in LibreSSL 3.5. ([#2838])
36
+ * Pre-existing socket file removed when TERM is issued after USR2 (if puma is running in cluster mode) ([#2817])
37
+ * Fix Puma::StateFile#load incompatibility ([#2810])
38
+
39
+ ## 5.6.4 / 2022-03-30
40
+
41
+ * Security
42
+ * Close several HTTP Request Smuggling exploits (CVE-2022-24790)
43
+
44
+ ## 5.6.2 / 2022-02-11
45
+
46
+ * Bugfix/Security
47
+ * Response body will always be `close`d. (GHSA-rmj8-8hhh-gv5h, related to [#2809])
48
+
49
+ ## 5.6.1 / 2022-01-26
50
+
51
+ * Bugfixes
52
+ * Reverted a commit which appeared to be causing occasional blank header values ([#2809])
53
+
54
+ ## 5.6.0 / 2022-01-25
55
+
56
+ * Features
57
+ * Support `localhost` integration in `ssl_bind` ([#2764], [#2708])
58
+ * Allow backlog parameter to be set with ssl_bind DSL ([#2780])
59
+ * Remove yaml (psych) requirement in StateFile ([#2784])
60
+ * Allow culling of oldest workers, previously was only youngest ([#2773], [#2794])
61
+ * Add worker_check_interval configuration option ([#2759])
62
+ * Always send lowlevel_error response to client ([#2731], [#2341])
63
+ * Support for cert_pem and key_pem with ssl_bind DSL ([#2728])
64
+
65
+ * Bugfixes
66
+ * Keep thread names under 15 characters, prevents breakage on some OSes ([#2733])
67
+ * Fix two 'old-style-definition' compile warning ([#2807], [#2806])
68
+ * Log environment correctly using option value ([#2799])
69
+ * Fix warning from Ruby master (will be 3.2.0) ([#2785])
70
+ * extconf.rb - fix openssl with old Windows builds ([#2757])
71
+ * server.rb - rescue handling (`Errno::EBADF`) for `@notify.close` ([#2745])
72
+
73
+ * Refactor
74
+ * server.rb - refactor code using @options[:remote_address] ([#2742])
75
+ * [jruby] a couple refactorings - avoid copy-ing bytes ([#2730])
76
+
77
+ ## 5.5.2 / 2021-10-12
78
+
79
+ * Bugfixes
80
+ * Allow UTF-8 in HTTP header values
81
+
82
+ ## 5.5.1 / 2021-10-12
83
+
84
+ * Feature (added as mistake - we don't normally do this on bugfix releases, sorry!)
85
+ * Allow setting APP_ENV in preference to RACK_ENV or RAILS_ENV ([#2702])
86
+
87
+ * Security
88
+ * Do not allow LF as a line ending in a header (CVE-2021-41136)
89
+
90
+ ## 5.5.0 / 2021-09-19
91
+
92
+ * Features
93
+ * Automatic SSL certificate provisioning for localhost, via localhost gem ([#2610], [#2257])
94
+ * add support for the PROXY protocol (v1 only) ([#2654], [#2651])
95
+ * Add a semantic CLI option for no config file ([#2689])
96
+
97
+ * Bugfixes
98
+ * More elaborate exception handling - lets some dead pumas die. ([#2700], [#2699])
99
+ * allow multiple after_worker_fork hooks ([#2690])
100
+ * Preserve BUNDLE_APP_CONFIG on worker fork ([#2688], [#2687])
101
+
102
+ * Performance
103
+ * Fix performance of server-side SSL connection close. ([#2675])
104
+
105
+ ## 5.4.0 / 2021-07-28
106
+
107
+ * Features
108
+ * Better/expanded names for threadpool threads ([#2657])
109
+ * Allow pkg_config for OpenSSL ([#2648], [#1412])
110
+ * Add `rack_url_scheme` to Puma::DSL, allows setting of `rack.url_scheme` header ([#2586], [#2569])
111
+
112
+ * Bugfixes
113
+ * `Binder#parse` - allow for symlinked unix path, add create_activated_fds debug ENV ([#2643], [#2638])
114
+ * Fix deprecation warning: minissl.c - Use Random.bytes if available ([#2642])
115
+ * Client certificates: set session id context while creating SSLContext ([#2633])
116
+ * Fix deadlock issue in thread pool ([#2656])
117
+
118
+ * Refactor
119
+ * Replace `IO.select` with `IO#wait_*` when checking a single IO ([#2666])
120
+
1
121
  ## 5.3.2 / 2021-05-21
2
122
 
3
123
  * Bugfixes
4
- * Gracefully handle Rack not accepting CLI options (#2630, #2626)
5
- * Fix sigterm misbehavior (#2629)
6
- * Improvements to keepalive-connection shedding (#2628)
124
+ * Gracefully handle Rack not accepting CLI options ([#2630], [#2626])
125
+ * Fix sigterm misbehavior ([#2629])
126
+ * Improvements to keepalive-connection shedding ([#2628])
7
127
 
8
128
  ## 5.3.1 / 2021-05-11
9
129
 
10
130
  * Security
11
- * Close keepalive connections after the maximum number of fast inlined requests (#2625)
131
+ * Close keepalive connections after the maximum number of fast inlined requests (CVE-2021-29509) ([#2625])
12
132
 
13
133
  ## 5.3.0 / 2021-05-07
14
134
 
@@ -220,10 +340,20 @@
220
340
  * Support parallel tests in verbose progress reporting ([#2223])
221
341
  * Refactor error handling in server accept loop ([#2239])
222
342
 
343
+ ## 4.3.10 / 2021-10-12
344
+
345
+ * Bugfixes
346
+ * Allow UTF-8 in HTTP header values
347
+
348
+ ## 4.3.9 / 2021-10-12
349
+
350
+ * Security
351
+ * Do not allow LF as a line ending in a header (CVE-2021-41136)
352
+
223
353
  ## 4.3.8 / 2021-05-11
224
354
 
225
355
  * Security
226
- * Close keepalive connections after the maximum number of fast inlined requests (#2625)
356
+ * Close keepalive connections after the maximum number of fast inlined requests (CVE-2021-29509) ([#2625])
227
357
 
228
358
  ## 4.3.7 / 2020-11-30
229
359
 
@@ -1753,6 +1883,81 @@ be added back in a future date when a java Puma::MiniSSL is added.
1753
1883
  * Bugfixes
1754
1884
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
1755
1885
 
1886
+ [#3166]:https://github.com/puma/puma/issues/3166 "Issue by @JoeDupuis, merged 2023-06-08"
1887
+ [#2883]:https://github.com/puma/puma/pull/2883 "PR by @MSP-Greg, merged 2022-06-02"
1888
+ [#2868]:https://github.com/puma/puma/pull/2868 "PR by @MSP-Greg, merged 2022-06-02"
1889
+ [#2866]:https://github.com/puma/puma/issues/2866 "Issue by @slondr, closed 2022-06-02"
1890
+ [#2888]:https://github.com/puma/puma/pull/2888 "PR by @MSP-Greg, merged 2022-06-01"
1891
+ [#2890]:https://github.com/puma/puma/pull/2890 "PR by @kares, merged 2022-06-01"
1892
+ [#2729]:https://github.com/puma/puma/issues/2729 "Issue by @kares, closed 2022-06-01"
1893
+ [#2885]:https://github.com/puma/puma/pull/2885 "PR by @MSP-Greg, merged 2022-05-30"
1894
+ [#2839]:https://github.com/puma/puma/issues/2839 "Issue by @wlipa, closed 2022-05-30"
1895
+ [#2882]:https://github.com/puma/puma/pull/2882 "PR by @MSP-Greg, merged 2022-05-19"
1896
+ [#2864]:https://github.com/puma/puma/pull/2864 "PR by @MSP-Greg, merged 2022-04-26"
1897
+ [#2863]:https://github.com/puma/puma/issues/2863 "Issue by @eradman, closed 2022-04-26"
1898
+ [#2861]:https://github.com/puma/puma/pull/2861 "PR by @BlakeWilliams, merged 2022-04-17"
1899
+ [#2856]:https://github.com/puma/puma/issues/2856 "Issue by @nateberkopec, closed 2022-04-17"
1900
+ [#2855]:https://github.com/puma/puma/pull/2855 "PR by @stanhu, merged 2022-04-09"
1901
+ [#2848]:https://github.com/puma/puma/pull/2848 "PR by @stanhu, merged 2022-04-02"
1902
+ [#2847]:https://github.com/puma/puma/pull/2847 "PR by @stanhu, merged 2022-04-02"
1903
+ [#2838]:https://github.com/puma/puma/pull/2838 "PR by @epsilon-0, merged 2022-03-03"
1904
+ [#2817]:https://github.com/puma/puma/pull/2817 "PR by @khustochka, merged 2022-02-20"
1905
+ [#2810]:https://github.com/puma/puma/pull/2810 "PR by @kzkn, merged 2022-01-27"
1906
+ [#2899]:https://github.com/puma/puma/pull/2899 "PR by @kares, merged 2022-07-04"
1907
+ [#2891]:https://github.com/puma/puma/pull/2891 "PR by @gingerlime, merged 2022-06-02"
1908
+ [#2886]:https://github.com/puma/puma/pull/2886 "PR by @kares, merged 2022-05-30"
1909
+ [#2884]:https://github.com/puma/puma/pull/2884 "PR by @kares, merged 2022-05-30"
1910
+ [#2875]:https://github.com/puma/puma/pull/2875 "PR by @ylecuyer, merged 2022-05-19"
1911
+ [#2840]:https://github.com/puma/puma/pull/2840 "PR by @LukaszMaslej, merged 2022-04-13"
1912
+ [#2849]:https://github.com/puma/puma/pull/2849 "PR by @kares, merged 2022-04-09"
1913
+ [#2809]:https://github.com/puma/puma/pull/2809 "PR by @dentarg, merged 2022-01-26"
1914
+ [#2764]:https://github.com/puma/puma/pull/2764 "PR by @dentarg, merged 2022-01-18"
1915
+ [#2708]:https://github.com/puma/puma/issues/2708 "Issue by @erikaxel, closed 2022-01-18"
1916
+ [#2780]:https://github.com/puma/puma/pull/2780 "PR by @dalibor, merged 2022-01-01"
1917
+ [#2784]:https://github.com/puma/puma/pull/2784 "PR by @MSP-Greg, merged 2022-01-01"
1918
+ [#2773]:https://github.com/puma/puma/pull/2773 "PR by @ob-stripe, merged 2022-01-01"
1919
+ [#2794]:https://github.com/puma/puma/pull/2794 "PR by @johnnyshields, merged 2022-01-10"
1920
+ [#2759]:https://github.com/puma/puma/pull/2759 "PR by @ob-stripe, merged 2021-12-11"
1921
+ [#2731]:https://github.com/puma/puma/pull/2731 "PR by @baelter, merged 2021-11-02"
1922
+ [#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, closed 2021-11-02"
1923
+ [#2728]:https://github.com/puma/puma/pull/2728 "PR by @dalibor, merged 2021-10-31"
1924
+ [#2733]:https://github.com/puma/puma/pull/2733 "PR by @ob-stripe, merged 2021-12-12"
1925
+ [#2807]:https://github.com/puma/puma/pull/2807 "PR by @MSP-Greg, merged 2022-01-25"
1926
+ [#2806]:https://github.com/puma/puma/issues/2806 "Issue by @olleolleolle, closed 2022-01-25"
1927
+ [#2799]:https://github.com/puma/puma/pull/2799 "PR by @ags, merged 2022-01-22"
1928
+ [#2785]:https://github.com/puma/puma/pull/2785 "PR by @MSP-Greg, merged 2022-01-02"
1929
+ [#2757]:https://github.com/puma/puma/pull/2757 "PR by @MSP-Greg, merged 2021-11-24"
1930
+ [#2745]:https://github.com/puma/puma/pull/2745 "PR by @MSP-Greg, merged 2021-11-03"
1931
+ [#2742]:https://github.com/puma/puma/pull/2742 "PR by @MSP-Greg, merged 2021-12-12"
1932
+ [#2730]:https://github.com/puma/puma/pull/2730 "PR by @kares, merged 2021-11-01"
1933
+ [#2702]:https://github.com/puma/puma/pull/2702 "PR by @jacobherrington, merged 2021-09-21"
1934
+ [#2610]:https://github.com/puma/puma/pull/2610 "PR by @ye-lin-aung, merged 2021-08-18"
1935
+ [#2257]:https://github.com/puma/puma/issues/2257 "Issue by @nateberkopec, closed 2021-08-18"
1936
+ [#2654]:https://github.com/puma/puma/pull/2654 "PR by @Roguelazer, merged 2021-09-07"
1937
+ [#2651]:https://github.com/puma/puma/issues/2651 "Issue by @Roguelazer, closed 2021-09-07"
1938
+ [#2689]:https://github.com/puma/puma/pull/2689 "PR by @jacobherrington, merged 2021-09-05"
1939
+ [#2700]:https://github.com/puma/puma/pull/2700 "PR by @ioquatix, merged 2021-09-16"
1940
+ [#2699]:https://github.com/puma/puma/issues/2699 "Issue by @ioquatix, closed 2021-09-16"
1941
+ [#2690]:https://github.com/puma/puma/pull/2690 "PR by @doits, merged 2021-09-06"
1942
+ [#2688]:https://github.com/puma/puma/pull/2688 "PR by @jdelStrother, merged 2021-09-03"
1943
+ [#2687]:https://github.com/puma/puma/issues/2687 "Issue by @jdelStrother, closed 2021-09-03"
1944
+ [#2675]:https://github.com/puma/puma/pull/2675 "PR by @devwout, merged 2021-09-08"
1945
+ [#2657]:https://github.com/puma/puma/pull/2657 "PR by @olivierbellone, merged 2021-07-13"
1946
+ [#2648]:https://github.com/puma/puma/pull/2648 "PR by @MSP-Greg, merged 2021-06-27"
1947
+ [#1412]:https://github.com/puma/puma/issues/1412 "Issue by @x-yuri, closed 2021-06-27"
1948
+ [#2586]:https://github.com/puma/puma/pull/2586 "PR by @MSP-Greg, merged 2021-05-26"
1949
+ [#2569]:https://github.com/puma/puma/issues/2569 "Issue by @tarragon, closed 2021-05-26"
1950
+ [#2643]:https://github.com/puma/puma/pull/2643 "PR by @MSP-Greg, merged 2021-06-27"
1951
+ [#2638]:https://github.com/puma/puma/issues/2638 "Issue by @gingerlime, closed 2021-06-27"
1952
+ [#2642]:https://github.com/puma/puma/pull/2642 "PR by @MSP-Greg, merged 2021-06-16"
1953
+ [#2633]:https://github.com/puma/puma/pull/2633 "PR by @onlined, merged 2021-06-04"
1954
+ [#2656]:https://github.com/puma/puma/pull/2656 "PR by @olivierbellone, merged 2021-07-07"
1955
+ [#2666]:https://github.com/puma/puma/pull/2666 "PR by @MSP-Greg, merged 2021-07-25"
1956
+ [#2630]:https://github.com/puma/puma/pull/2630 "PR by @seangoedecke, merged 2021-05-20"
1957
+ [#2626]:https://github.com/puma/puma/issues/2626 "Issue by @rorymckinley, closed 2021-05-20"
1958
+ [#2629]:https://github.com/puma/puma/pull/2629 "PR by @ye-lin-aung, merged 2021-05-20"
1959
+ [#2628]:https://github.com/puma/puma/pull/2628 "PR by @wjordan, merged 2021-05-20"
1960
+ [#2625]:https://github.com/puma/puma/issues/2625 "Issue by @jarthod, closed 2021-05-11"
1756
1961
  [#2564]:https://github.com/puma/puma/pull/2564 "PR by @MSP-Greg, merged 2021-04-24"
1757
1962
  [#2526]:https://github.com/puma/puma/issues/2526 "Issue by @nerdrew, closed 2021-04-24"
1758
1963
  [#2559]:https://github.com/puma/puma/pull/2559 "PR by @ylecuyer, merged 2021-03-11"
@@ -1767,11 +1972,11 @@ be added back in a future date when a java Puma::MiniSSL is added.
1767
1972
  [#2605]:https://github.com/puma/puma/pull/2605 "PR by @pascalbetz, merged 2021-04-26"
1768
1973
  [#2584]:https://github.com/puma/puma/issues/2584 "Issue by @kaorihinata, closed 2021-04-26"
1769
1974
  [#2607]:https://github.com/puma/puma/pull/2607 "PR by @calvinxiao, merged 2021-04-23"
1770
- [#2552]:https://github.com/puma/puma/issues/2552 "Issue by @feliperaul, opened 2021-02-09"
1975
+ [#2552]:https://github.com/puma/puma/issues/2552 "Issue by @feliperaul, closed 2021-05-24"
1771
1976
  [#2606]:https://github.com/puma/puma/pull/2606 "PR by @wjordan, merged 2021-04-20"
1772
1977
  [#2574]:https://github.com/puma/puma/issues/2574 "Issue by @darkhelmet, closed 2021-04-20"
1773
- [#2567]:https://github.com/puma/puma/pull/2567 "PR by @kddeisz, merged 2021-04-19"
1774
- [#2566]:https://github.com/puma/puma/issues/2566 "Issue by @kddeisz, closed 2021-04-19"
1978
+ [#2567]:https://github.com/puma/puma/pull/2567 "PR by @kddnewton, merged 2021-04-19"
1979
+ [#2566]:https://github.com/puma/puma/issues/2566 "Issue by @kddnewton, closed 2021-04-19"
1775
1980
  [#2596]:https://github.com/puma/puma/pull/2596 "PR by @MSP-Greg, merged 2021-04-18"
1776
1981
  [#2588]:https://github.com/puma/puma/pull/2588 "PR by @dentarg, merged 2021-04-02"
1777
1982
  [#2556]:https://github.com/puma/puma/issues/2556 "Issue by @gamecreature, closed 2021-04-02"
@@ -1790,7 +1995,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1790
1995
  [#2519]:https://github.com/puma/puma/pull/2519 "PR by @MSP-Greg, merged 2021-01-26"
1791
1996
  [#2522]:https://github.com/puma/puma/pull/2522 "PR by @jcmfernandes, merged 2021-01-12"
1792
1997
  [#2490]:https://github.com/puma/puma/pull/2490 "PR by @Bonias, merged 2020-12-07"
1793
- [#2486]:https://github.com/puma/puma/pull/2486 "PR by @ccverak, merged 2020-12-02"
1998
+ [#2486]:https://github.com/puma/puma/pull/2486 "PR by @karloscodes, merged 2020-12-02"
1794
1999
  [#2535]:https://github.com/puma/puma/pull/2535 "PR by @MSP-Greg, merged 2021-01-27"
1795
2000
  [#2529]:https://github.com/puma/puma/pull/2529 "PR by @MSP-Greg, merged 2021-01-24"
1796
2001
  [#2533]:https://github.com/puma/puma/pull/2533 "PR by @MSP-Greg, merged 2021-01-24"
@@ -1800,7 +2005,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1800
2005
  [#2521]:https://github.com/puma/puma/pull/2521 "PR by @ojab, merged 2021-01-04"
1801
2006
  [#2531]:https://github.com/puma/puma/pull/2531 "PR by @wjordan, merged 2021-01-19"
1802
2007
  [#2510]:https://github.com/puma/puma/pull/2510 "PR by @micke, merged 2020-12-10"
1803
- [#2472]:https://github.com/puma/puma/pull/2472 "PR by @ccverak, merged 2020-11-02"
2008
+ [#2472]:https://github.com/puma/puma/pull/2472 "PR by @karloscodes, merged 2020-11-02"
1804
2009
  [#2438]:https://github.com/puma/puma/pull/2438 "PR by @ekohl, merged 2020-10-26"
1805
2010
  [#2406]:https://github.com/puma/puma/pull/2406 "PR by @fdel15, merged 2020-10-19"
1806
2011
  [#2449]:https://github.com/puma/puma/pull/2449 "PR by @MSP-Greg, merged 2020-10-28"
@@ -2227,7 +2432,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2227
2432
  [#709]:https://github.com/puma/puma/pull/709 "PR by @lian, merged 2015-06-10"
2228
2433
  [#711]:https://github.com/puma/puma/pull/711 "PR by @julik, merged 2015-06-10"
2229
2434
  [#712]:https://github.com/puma/puma/pull/712 "PR by @chewi, merged 2015-07-14"
2230
- [#715]:https://github.com/puma/puma/pull/715 "PR by @0RaymondJiang0, merged 2015-07-14"
2435
+ [#715]:https://github.com/puma/puma/pull/715 "PR by @raymondmars, merged 2015-07-14"
2231
2436
  [#725]:https://github.com/puma/puma/pull/725 "PR by @rwz, merged 2015-07-14"
2232
2437
  [#726]:https://github.com/puma/puma/pull/726 "PR by @jshafton, merged 2015-07-14"
2233
2438
  [#729]:https://github.com/puma/puma/pull/729 "PR by @allaire, merged 2015-07-14"
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <img src="https://puma.io/images/logos/puma-logo-large.png">
3
3
  </p>
4
4
 
5
- # Puma: A Ruby Web Server Built For Concurrency
5
+ # Puma: A Ruby Web Server Built For Parallelism
6
6
 
7
7
  [![Actions MRI](https://github.com/puma/puma/workflows/MRI/badge.svg?branch=master)](https://github.com/puma/puma/actions?query=workflow%3AMRI)
8
8
  [![Actions non MRI](https://github.com/puma/puma/workflows/non_MRI/badge.svg?branch=master)](https://github.com/puma/puma/actions?query=workflow%3Anon_MRI)
@@ -10,11 +10,11 @@
10
10
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=puma&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=puma&package-manager=bundler&version-scheme=semver)
11
11
  [![StackOverflow](https://img.shields.io/badge/stackoverflow-Puma-blue.svg)]( https://stackoverflow.com/questions/tagged/puma )
12
12
 
13
- Puma is a **simple, fast, multi-threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications**.
13
+ Puma is a **simple, fast, multi-threaded, and highly parallel HTTP 1.1 server for Ruby/Rack applications**.
14
14
 
15
- ## Built For Speed &amp; Concurrency
15
+ ## Built For Speed &amp; Parallelism
16
16
 
17
- Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request using a thread pool. Each request is served in a separate thread, so truly concurrent Ruby implementations (JRuby, Rubinius) will use all available CPU cores.
17
+ Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request using a thread pool. Each request is served in a separate thread, so truly parallel Ruby implementations (JRuby, Rubinius) will use all available CPU cores.
18
18
 
19
19
  Originally designed as a server for [Rubinius](https://github.com/rubinius/rubinius), Puma also works well with Ruby (MRI) and JRuby.
20
20
 
@@ -137,6 +137,11 @@ This code can be used to setup the process before booting the application, allow
137
137
  you to do some Puma-specific things that you don't want to embed in your application.
138
138
  For instance, you could fire a log notification that a worker booted or send something to statsd. This can be called multiple times.
139
139
 
140
+ Constants loaded by your application (such as `Rails`) will not be available in `on_worker_boot`.
141
+ However, these constants _will_ be available if `preload_app!` is enabled, either explicitly in your `puma` config or automatically if
142
+ using 2 or more workers in cluster mode.
143
+ If `preload_app!` is not enabled and 1 worker is used, then `on_worker_boot` will fire, but your app will not be preloaded and constants will not be available.
144
+
140
145
  `before_fork` specifies a block to be run before workers are forked:
141
146
 
142
147
  ```ruby
@@ -187,6 +192,38 @@ Need a bit of security? Use SSL sockets:
187
192
  ```
188
193
  $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
189
194
  ```
195
+ #### Self-signed SSL certificates (via the [`localhost`] gem, for development use):
196
+
197
+ Puma supports the [`localhost`] gem for self-signed certificates. This is particularly useful if you want to use Puma with SSL locally, and self-signed certificates will work for your use-case. Currently, the integration can only be used in MRI.
198
+
199
+ Puma automatically configures SSL when the [`localhost`] gem is loaded in a `development` environment:
200
+
201
+ ```ruby
202
+ # Add the gem to your Gemfile
203
+ group(:development) do
204
+ gem 'localhost'
205
+ end
206
+
207
+ # And require it implicitly using bundler
208
+ require "bundler"
209
+ Bundler.require(:default, ENV["RACK_ENV"].to_sym)
210
+
211
+ # Alternatively, you can require the gem in config.ru:
212
+ require './app'
213
+ require 'localhost'
214
+ run Sinatra::Application
215
+ ```
216
+
217
+ Additionally, Puma must be listening to an SSL socket:
218
+
219
+ ```shell
220
+ $ puma -b 'ssl://localhost:9292' config.ru
221
+
222
+ # The following options allow you to reach Puma over HTTP as well:
223
+ $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 config.ru
224
+ ```
225
+
226
+ [`localhost`]: https://github.com/socketry/localhost
190
227
 
191
228
  #### Controlling SSL Cipher Suites
192
229
 
@@ -255,11 +292,15 @@ You can also provide a configuration file with the `-C` (or `--config`) flag:
255
292
  $ puma -C /path/to/config
256
293
  ```
257
294
 
258
- If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified, either via the `-e` and `--environment` flags, or through the `RACK_ENV` or the `RAILS_ENV` environment variables, Puma first looks for configuration at `config/puma/<environment_name>.rb`, and then falls back to `config/puma.rb`.
295
+ If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified (via the `--environment` flag or through the `APP_ENV`, `RACK_ENV`, or `RAILS_ENV` environment variables) Puma looks for a configuration file at `config/puma/<environment_name>.rb` and then falls back to `config/puma.rb`.
259
296
 
260
- If you want to prevent Puma from looking for a configuration file in those locations, provide a dash as the argument to the `-C` (or `--config`) flag:
297
+ If you want to prevent Puma from looking for a configuration file in those locations, include the `--no-config` flag:
261
298
 
262
299
  ```
300
+ $ puma --no-config
301
+
302
+ # or
303
+
263
304
  $ puma -C "-"
264
305
  ```
265
306
 
data/docs/architecture.md CHANGED
@@ -4,38 +4,71 @@
4
4
 
5
5
  ![https://bit.ly/2iJuFky](images/puma-general-arch.png)
6
6
 
7
- Puma is a threaded Ruby HTTP application server, processing requests across a TCP or UNIX socket.
7
+ Puma is a threaded Ruby HTTP application server processing requests across a TCP
8
+ and/or UNIX socket.
8
9
 
9
10
 
10
- Puma processes (there can be one or many) accept connections from the socket via a thread (in the [`Reactor`](../lib/puma/reactor.rb) class). The connection, once fully buffered and read, moves in to the `todo` list, where it will be picked up by a free/waiting thread in the threadpool (the [`ThreadPool`](../lib/puma/thread_pool.rb) class).
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).
11
16
 
12
- Puma works in two main modes: cluster and single. In single mode, only one Puma process is booted. In cluster mode, a `master` process is booted, which prepares (and may boot) the application, and then uses the `fork()` system call to create 1 or more `child` processes. These `child` processes all listen to the same socket. The `master` process does not listen to the socket or process requests - its purpose is mostly to manage and listen for UNIX signals and possibly kill or boot `child` processes.
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.
13
24
 
14
- We sometimes call `child` processes (or Puma processes in `single` mode) _workers_, and we sometimes call the threads created by Puma's [`ThreadPool`](../lib/puma/thread_pool.rb) _worker threads_.
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_.
15
28
 
16
29
  ## How Requests Work
17
30
 
18
31
  ![https://bit.ly/2zwzhEK](images/puma-connection-flow.png)
19
32
 
20
33
  * Upon startup, Puma listens on a TCP or UNIX socket.
21
- * The backlog of this socket is configured (with a default of 1024). This determines the size of the queue for unaccepted connections. Generally, this setting is unimportant and will never be hit in production use. If the backlog is full, the connection will be refused by the operating system.
22
- * This socket backlog is distinct from the `backlog` of work as reported by `Puma.stats` or the control server. The backlog as reported by Puma is the number of connections in the process' `todo` set waiting for a thread from the [`ThreadPool`](../lib/puma/thread_pool.rb).
23
- * By default, a single, separate thread (created by the [`Reactor`](../lib/puma/reactor.rb) class) is used to read and buffer requests from the socket.
24
- * When at least one worker thread is available for work, the reactor thread listens to the socket and accepts a request, if one is waiting.
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).
25
47
  * The reactor thread waits for the entire HTTP request to be received.
26
- * The time spent waiting for the HTTP request body to be received is exposed to the Rack app as `env['puma.request_body_wait']` (milliseconds).
27
- * Once fully buffered and received, the connection is pushed into the "todo" set.
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.
28
53
  * Worker threads pop work off the "todo" set for processing.
29
- * The worker thread processes the request via `call`ing the configured Rack application. The Rack application generates the HTTP response.
30
- * The worker thread writes the response to the connection. Note that while Puma buffers requests via a separate thread, it does not use a separate thread for responses.
31
- * Once done, the thread become available to process another connection in the "todo" set.
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.
32
61
 
33
62
  ### `queue_requests`
34
63
 
35
64
  ![https://bit.ly/2zxCJ1Z](images/puma-connection-flow-no-reactor.png)
36
65
 
37
- The `queue_requests` option is `true` by default, enabling the separate reactor thread used to buffer requests as described above.
66
+ The `queue_requests` option is `true` by default, enabling the separate reactor
67
+ thread used to buffer requests as described above.
38
68
 
39
- If set to `false`, this buffer will not be used for connections while waiting for the request to arrive.
69
+ If set to `false`, this buffer will not be used for connections while waiting
70
+ for the request to arrive.
40
71
 
41
- In this mode, when a connection is accepted, it is added to the "todo" queue immediately, and a worker will synchronously do any waiting necessary to read the HTTP request from the socket.
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.
@@ -1,10 +1,12 @@
1
1
  # Compile Options
2
2
 
3
- There are some `cflags` provided to change Puma's default configuration for its C extension.
3
+ There are some `cflags` provided to change Puma's default configuration for its
4
+ C extension.
4
5
 
5
6
  ## Query String, `PUMA_QUERY_STRING_MAX_LENGTH`
6
7
 
7
- By default, the max length of `QUERY_STRING` is `1024 * 10`. But you may want to adjust it to allow accept larger queries in GET requests.
8
+ By default, the max length of `QUERY_STRING` is `1024 * 10`. But you may want to
9
+ adjust it to accept longer queries in GET requests.
8
10
 
9
11
  For manual install, pass the `PUMA_QUERY_STRING_MAX_LENGTH` option like this:
10
12