puma 5.3.2 → 5.6.8

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.

Potentially problematic release.


This version of puma might be problematic. Click here for more details.

Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +211 -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/Http11Parser.java +49 -47
  18. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +38 -55
  19. data/ext/puma_http11/puma_http11.c +1 -1
  20. data/lib/puma/app/status.rb +7 -4
  21. data/lib/puma/binder.rb +51 -6
  22. data/lib/puma/cli.rb +14 -4
  23. data/lib/puma/client.rb +143 -25
  24. data/lib/puma/cluster/worker.rb +8 -18
  25. data/lib/puma/cluster/worker_handle.rb +4 -0
  26. data/lib/puma/cluster.rb +30 -24
  27. data/lib/puma/configuration.rb +4 -1
  28. data/lib/puma/const.rb +9 -8
  29. data/lib/puma/control_cli.rb +19 -13
  30. data/lib/puma/detect.rb +8 -2
  31. data/lib/puma/dsl.rb +111 -13
  32. data/lib/puma/{json.rb → json_serialization.rb} +1 -1
  33. data/lib/puma/launcher.rb +15 -1
  34. data/lib/puma/minissl/context_builder.rb +8 -6
  35. data/lib/puma/minissl.rb +33 -27
  36. data/lib/puma/null_io.rb +5 -0
  37. data/lib/puma/plugin.rb +2 -2
  38. data/lib/puma/rack/builder.rb +1 -1
  39. data/lib/puma/request.rb +19 -10
  40. data/lib/puma/runner.rb +22 -8
  41. data/lib/puma/server.rb +37 -29
  42. data/lib/puma/state_file.rb +42 -7
  43. data/lib/puma/thread_pool.rb +7 -5
  44. data/lib/puma/util.rb +20 -4
  45. data/lib/puma.rb +6 -4
  46. data/lib/rack/version_restriction.rb +15 -0
  47. data/tools/Dockerfile +1 -1
  48. 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: cc34dc2b7094b86d3eec5100455de02cdcfb14a2e382059565e06e512d5c40ac
4
+ data.tar.gz: 10080424606d3a4613f1b27b33199a048711da57e4b45a55f7e997346c64c419
5
5
  SHA512:
6
- metadata.gz: 14a0bde86f109197089905694c259d2382d86000ab877cb8eaf44c593866afdedad173d1c7c9eb1efe48a714ee33f6b5e4c3c32fe420d3298ab3511c9fae0a7a
7
- data.tar.gz: a31d4feee8e6a36c27d1037ad91cc279c294505ecbb143c3a005f7d0817031c9b80cef465b5800c6c6075f16f587e43fa98de8dd2b99fe92996c9c9fba36ea70
6
+ metadata.gz: 18da16eff3311151ff29f868f07762d509541b1302dd6ff80bf323bb6fdd73da9d8bc32983a37b71e439faf4753e8110bdafb8f444df205b62f742376c980147
7
+ data.tar.gz: 89968813be0e066fc4de68dc439827d621d2d1803c58c64ee2df78f4d9baa4785fc7865d655990564ff52d9cd64ebc8d9dbc4be048334e0f8db954d83efaeef1
data/History.md CHANGED
@@ -1,14 +1,129 @@
1
+ ## 5.6.8 / 2023-01-08
2
+
3
+ * Security
4
+ * 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))
5
+
6
+ ## 5.6.7 / 2023-08-18
7
+
8
+ * Security
9
+ * 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))
10
+
11
+ ## 5.6.6 / 2023-06-21
12
+
13
+ * Bugfix
14
+ * Allow Puma to be loaded with Rack 3 ([#3166])
15
+
16
+ ## 5.6.5 / 2022-08-23
17
+
18
+ * Feature
19
+ * Puma::ControlCLI - allow refork command to be sent as a request ([#2868], [#2866])
20
+
21
+ * Bugfixes
22
+ * NullIO#closed should return false ([#2883])
23
+ * [jruby] Fix TLS verification hang ([#2890], [#2729])
24
+ * extconf.rb - don't use pkg_config('openssl') if '--with-openssl-dir' is used ([#2885], [#2839])
25
+ * MiniSSL - detect SSL_CTX_set_dh_auto ([#2864], [#2863])
26
+ * Fix rack.after_reply exceptions breaking connections ([#2861], [#2856])
27
+ * Escape SSL cert and filenames ([#2855])
28
+ * Fail hard if SSL certs or keys are invalid ([#2848])
29
+ * Fail hard if SSL certs or keys cannot be read by user ([#2847])
30
+ * Fix build with Opaque DH in LibreSSL 3.5. ([#2838])
31
+ * Pre-existing socket file removed when TERM is issued after USR2 (if puma is running in cluster mode) ([#2817])
32
+ * Fix Puma::StateFile#load incompatibility ([#2810])
33
+
34
+ ## 5.6.4 / 2022-03-30
35
+
36
+ * Security
37
+ * Close several HTTP Request Smuggling exploits (CVE-2022-24790)
38
+
39
+ ## 5.6.2 / 2022-02-11
40
+
41
+ * Bugfix/Security
42
+ * Response body will always be `close`d. (GHSA-rmj8-8hhh-gv5h, related to [#2809])
43
+
44
+ ## 5.6.1 / 2022-01-26
45
+
46
+ * Bugfixes
47
+ * Reverted a commit which appeared to be causing occasional blank header values ([#2809])
48
+
49
+ ## 5.6.0 / 2022-01-25
50
+
51
+ * Features
52
+ * Support `localhost` integration in `ssl_bind` ([#2764], [#2708])
53
+ * Allow backlog parameter to be set with ssl_bind DSL ([#2780])
54
+ * Remove yaml (psych) requirement in StateFile ([#2784])
55
+ * Allow culling of oldest workers, previously was only youngest ([#2773], [#2794])
56
+ * Add worker_check_interval configuration option ([#2759])
57
+ * Always send lowlevel_error response to client ([#2731], [#2341])
58
+ * Support for cert_pem and key_pem with ssl_bind DSL ([#2728])
59
+
60
+ * Bugfixes
61
+ * Keep thread names under 15 characters, prevents breakage on some OSes ([#2733])
62
+ * Fix two 'old-style-definition' compile warning ([#2807], [#2806])
63
+ * Log environment correctly using option value ([#2799])
64
+ * Fix warning from Ruby master (will be 3.2.0) ([#2785])
65
+ * extconf.rb - fix openssl with old Windows builds ([#2757])
66
+ * server.rb - rescue handling (`Errno::EBADF`) for `@notify.close` ([#2745])
67
+
68
+ * Refactor
69
+ * server.rb - refactor code using @options[:remote_address] ([#2742])
70
+ * [jruby] a couple refactorings - avoid copy-ing bytes ([#2730])
71
+
72
+ ## 5.5.2 / 2021-10-12
73
+
74
+ * Bugfixes
75
+ * Allow UTF-8 in HTTP header values
76
+
77
+ ## 5.5.1 / 2021-10-12
78
+
79
+ * Feature (added as mistake - we don't normally do this on bugfix releases, sorry!)
80
+ * Allow setting APP_ENV in preference to RACK_ENV or RAILS_ENV ([#2702])
81
+
82
+ * Security
83
+ * Do not allow LF as a line ending in a header (CVE-2021-41136)
84
+
85
+ ## 5.5.0 / 2021-09-19
86
+
87
+ * Features
88
+ * Automatic SSL certificate provisioning for localhost, via localhost gem ([#2610], [#2257])
89
+ * add support for the PROXY protocol (v1 only) ([#2654], [#2651])
90
+ * Add a semantic CLI option for no config file ([#2689])
91
+
92
+ * Bugfixes
93
+ * More elaborate exception handling - lets some dead pumas die. ([#2700], [#2699])
94
+ * allow multiple after_worker_fork hooks ([#2690])
95
+ * Preserve BUNDLE_APP_CONFIG on worker fork ([#2688], [#2687])
96
+
97
+ * Performance
98
+ * Fix performance of server-side SSL connection close. ([#2675])
99
+
100
+ ## 5.4.0 / 2021-07-28
101
+
102
+ * Features
103
+ * Better/expanded names for threadpool threads ([#2657])
104
+ * Allow pkg_config for OpenSSL ([#2648], [#1412])
105
+ * Add `rack_url_scheme` to Puma::DSL, allows setting of `rack.url_scheme` header ([#2586], [#2569])
106
+
107
+ * Bugfixes
108
+ * `Binder#parse` - allow for symlinked unix path, add create_activated_fds debug ENV ([#2643], [#2638])
109
+ * Fix deprecation warning: minissl.c - Use Random.bytes if available ([#2642])
110
+ * Client certificates: set session id context while creating SSLContext ([#2633])
111
+ * Fix deadlock issue in thread pool ([#2656])
112
+
113
+ * Refactor
114
+ * Replace `IO.select` with `IO#wait_*` when checking a single IO ([#2666])
115
+
1
116
  ## 5.3.2 / 2021-05-21
2
117
 
3
118
  * Bugfixes
4
- * Gracefully handle Rack not accepting CLI options (#2630, #2626)
5
- * Fix sigterm misbehavior (#2629)
6
- * Improvements to keepalive-connection shedding (#2628)
119
+ * Gracefully handle Rack not accepting CLI options ([#2630], [#2626])
120
+ * Fix sigterm misbehavior ([#2629])
121
+ * Improvements to keepalive-connection shedding ([#2628])
7
122
 
8
123
  ## 5.3.1 / 2021-05-11
9
124
 
10
125
  * Security
11
- * Close keepalive connections after the maximum number of fast inlined requests (#2625)
126
+ * Close keepalive connections after the maximum number of fast inlined requests (CVE-2021-29509) ([#2625])
12
127
 
13
128
  ## 5.3.0 / 2021-05-07
14
129
 
@@ -220,10 +335,20 @@
220
335
  * Support parallel tests in verbose progress reporting ([#2223])
221
336
  * Refactor error handling in server accept loop ([#2239])
222
337
 
338
+ ## 4.3.10 / 2021-10-12
339
+
340
+ * Bugfixes
341
+ * Allow UTF-8 in HTTP header values
342
+
343
+ ## 4.3.9 / 2021-10-12
344
+
345
+ * Security
346
+ * Do not allow LF as a line ending in a header (CVE-2021-41136)
347
+
223
348
  ## 4.3.8 / 2021-05-11
224
349
 
225
350
  * Security
226
- * Close keepalive connections after the maximum number of fast inlined requests (#2625)
351
+ * Close keepalive connections after the maximum number of fast inlined requests (CVE-2021-29509) ([#2625])
227
352
 
228
353
  ## 4.3.7 / 2020-11-30
229
354
 
@@ -1753,6 +1878,81 @@ be added back in a future date when a java Puma::MiniSSL is added.
1753
1878
  * Bugfixes
1754
1879
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
1755
1880
 
1881
+ [#3166]:https://github.com/puma/puma/issues/3166 "Issue by @JoeDupuis, merged 2023-06-08"
1882
+ [#2883]:https://github.com/puma/puma/pull/2883 "PR by @MSP-Greg, merged 2022-06-02"
1883
+ [#2868]:https://github.com/puma/puma/pull/2868 "PR by @MSP-Greg, merged 2022-06-02"
1884
+ [#2866]:https://github.com/puma/puma/issues/2866 "Issue by @slondr, closed 2022-06-02"
1885
+ [#2888]:https://github.com/puma/puma/pull/2888 "PR by @MSP-Greg, merged 2022-06-01"
1886
+ [#2890]:https://github.com/puma/puma/pull/2890 "PR by @kares, merged 2022-06-01"
1887
+ [#2729]:https://github.com/puma/puma/issues/2729 "Issue by @kares, closed 2022-06-01"
1888
+ [#2885]:https://github.com/puma/puma/pull/2885 "PR by @MSP-Greg, merged 2022-05-30"
1889
+ [#2839]:https://github.com/puma/puma/issues/2839 "Issue by @wlipa, closed 2022-05-30"
1890
+ [#2882]:https://github.com/puma/puma/pull/2882 "PR by @MSP-Greg, merged 2022-05-19"
1891
+ [#2864]:https://github.com/puma/puma/pull/2864 "PR by @MSP-Greg, merged 2022-04-26"
1892
+ [#2863]:https://github.com/puma/puma/issues/2863 "Issue by @eradman, closed 2022-04-26"
1893
+ [#2861]:https://github.com/puma/puma/pull/2861 "PR by @BlakeWilliams, merged 2022-04-17"
1894
+ [#2856]:https://github.com/puma/puma/issues/2856 "Issue by @nateberkopec, closed 2022-04-17"
1895
+ [#2855]:https://github.com/puma/puma/pull/2855 "PR by @stanhu, merged 2022-04-09"
1896
+ [#2848]:https://github.com/puma/puma/pull/2848 "PR by @stanhu, merged 2022-04-02"
1897
+ [#2847]:https://github.com/puma/puma/pull/2847 "PR by @stanhu, merged 2022-04-02"
1898
+ [#2838]:https://github.com/puma/puma/pull/2838 "PR by @epsilon-0, merged 2022-03-03"
1899
+ [#2817]:https://github.com/puma/puma/pull/2817 "PR by @khustochka, merged 2022-02-20"
1900
+ [#2810]:https://github.com/puma/puma/pull/2810 "PR by @kzkn, merged 2022-01-27"
1901
+ [#2899]:https://github.com/puma/puma/pull/2899 "PR by @kares, merged 2022-07-04"
1902
+ [#2891]:https://github.com/puma/puma/pull/2891 "PR by @gingerlime, merged 2022-06-02"
1903
+ [#2886]:https://github.com/puma/puma/pull/2886 "PR by @kares, merged 2022-05-30"
1904
+ [#2884]:https://github.com/puma/puma/pull/2884 "PR by @kares, merged 2022-05-30"
1905
+ [#2875]:https://github.com/puma/puma/pull/2875 "PR by @ylecuyer, merged 2022-05-19"
1906
+ [#2840]:https://github.com/puma/puma/pull/2840 "PR by @LukaszMaslej, merged 2022-04-13"
1907
+ [#2849]:https://github.com/puma/puma/pull/2849 "PR by @kares, merged 2022-04-09"
1908
+ [#2809]:https://github.com/puma/puma/pull/2809 "PR by @dentarg, merged 2022-01-26"
1909
+ [#2764]:https://github.com/puma/puma/pull/2764 "PR by @dentarg, merged 2022-01-18"
1910
+ [#2708]:https://github.com/puma/puma/issues/2708 "Issue by @erikaxel, closed 2022-01-18"
1911
+ [#2780]:https://github.com/puma/puma/pull/2780 "PR by @dalibor, merged 2022-01-01"
1912
+ [#2784]:https://github.com/puma/puma/pull/2784 "PR by @MSP-Greg, merged 2022-01-01"
1913
+ [#2773]:https://github.com/puma/puma/pull/2773 "PR by @ob-stripe, merged 2022-01-01"
1914
+ [#2794]:https://github.com/puma/puma/pull/2794 "PR by @johnnyshields, merged 2022-01-10"
1915
+ [#2759]:https://github.com/puma/puma/pull/2759 "PR by @ob-stripe, merged 2021-12-11"
1916
+ [#2731]:https://github.com/puma/puma/pull/2731 "PR by @baelter, merged 2021-11-02"
1917
+ [#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, closed 2021-11-02"
1918
+ [#2728]:https://github.com/puma/puma/pull/2728 "PR by @dalibor, merged 2021-10-31"
1919
+ [#2733]:https://github.com/puma/puma/pull/2733 "PR by @ob-stripe, merged 2021-12-12"
1920
+ [#2807]:https://github.com/puma/puma/pull/2807 "PR by @MSP-Greg, merged 2022-01-25"
1921
+ [#2806]:https://github.com/puma/puma/issues/2806 "Issue by @olleolleolle, closed 2022-01-25"
1922
+ [#2799]:https://github.com/puma/puma/pull/2799 "PR by @ags, merged 2022-01-22"
1923
+ [#2785]:https://github.com/puma/puma/pull/2785 "PR by @MSP-Greg, merged 2022-01-02"
1924
+ [#2757]:https://github.com/puma/puma/pull/2757 "PR by @MSP-Greg, merged 2021-11-24"
1925
+ [#2745]:https://github.com/puma/puma/pull/2745 "PR by @MSP-Greg, merged 2021-11-03"
1926
+ [#2742]:https://github.com/puma/puma/pull/2742 "PR by @MSP-Greg, merged 2021-12-12"
1927
+ [#2730]:https://github.com/puma/puma/pull/2730 "PR by @kares, merged 2021-11-01"
1928
+ [#2702]:https://github.com/puma/puma/pull/2702 "PR by @jacobherrington, merged 2021-09-21"
1929
+ [#2610]:https://github.com/puma/puma/pull/2610 "PR by @ye-lin-aung, merged 2021-08-18"
1930
+ [#2257]:https://github.com/puma/puma/issues/2257 "Issue by @nateberkopec, closed 2021-08-18"
1931
+ [#2654]:https://github.com/puma/puma/pull/2654 "PR by @Roguelazer, merged 2021-09-07"
1932
+ [#2651]:https://github.com/puma/puma/issues/2651 "Issue by @Roguelazer, closed 2021-09-07"
1933
+ [#2689]:https://github.com/puma/puma/pull/2689 "PR by @jacobherrington, merged 2021-09-05"
1934
+ [#2700]:https://github.com/puma/puma/pull/2700 "PR by @ioquatix, merged 2021-09-16"
1935
+ [#2699]:https://github.com/puma/puma/issues/2699 "Issue by @ioquatix, closed 2021-09-16"
1936
+ [#2690]:https://github.com/puma/puma/pull/2690 "PR by @doits, merged 2021-09-06"
1937
+ [#2688]:https://github.com/puma/puma/pull/2688 "PR by @jdelStrother, merged 2021-09-03"
1938
+ [#2687]:https://github.com/puma/puma/issues/2687 "Issue by @jdelStrother, closed 2021-09-03"
1939
+ [#2675]:https://github.com/puma/puma/pull/2675 "PR by @devwout, merged 2021-09-08"
1940
+ [#2657]:https://github.com/puma/puma/pull/2657 "PR by @olivierbellone, merged 2021-07-13"
1941
+ [#2648]:https://github.com/puma/puma/pull/2648 "PR by @MSP-Greg, merged 2021-06-27"
1942
+ [#1412]:https://github.com/puma/puma/issues/1412 "Issue by @x-yuri, closed 2021-06-27"
1943
+ [#2586]:https://github.com/puma/puma/pull/2586 "PR by @MSP-Greg, merged 2021-05-26"
1944
+ [#2569]:https://github.com/puma/puma/issues/2569 "Issue by @tarragon, closed 2021-05-26"
1945
+ [#2643]:https://github.com/puma/puma/pull/2643 "PR by @MSP-Greg, merged 2021-06-27"
1946
+ [#2638]:https://github.com/puma/puma/issues/2638 "Issue by @gingerlime, closed 2021-06-27"
1947
+ [#2642]:https://github.com/puma/puma/pull/2642 "PR by @MSP-Greg, merged 2021-06-16"
1948
+ [#2633]:https://github.com/puma/puma/pull/2633 "PR by @onlined, merged 2021-06-04"
1949
+ [#2656]:https://github.com/puma/puma/pull/2656 "PR by @olivierbellone, merged 2021-07-07"
1950
+ [#2666]:https://github.com/puma/puma/pull/2666 "PR by @MSP-Greg, merged 2021-07-25"
1951
+ [#2630]:https://github.com/puma/puma/pull/2630 "PR by @seangoedecke, merged 2021-05-20"
1952
+ [#2626]:https://github.com/puma/puma/issues/2626 "Issue by @rorymckinley, closed 2021-05-20"
1953
+ [#2629]:https://github.com/puma/puma/pull/2629 "PR by @ye-lin-aung, merged 2021-05-20"
1954
+ [#2628]:https://github.com/puma/puma/pull/2628 "PR by @wjordan, merged 2021-05-20"
1955
+ [#2625]:https://github.com/puma/puma/issues/2625 "Issue by @jarthod, closed 2021-05-11"
1756
1956
  [#2564]:https://github.com/puma/puma/pull/2564 "PR by @MSP-Greg, merged 2021-04-24"
1757
1957
  [#2526]:https://github.com/puma/puma/issues/2526 "Issue by @nerdrew, closed 2021-04-24"
1758
1958
  [#2559]:https://github.com/puma/puma/pull/2559 "PR by @ylecuyer, merged 2021-03-11"
@@ -1767,11 +1967,11 @@ be added back in a future date when a java Puma::MiniSSL is added.
1767
1967
  [#2605]:https://github.com/puma/puma/pull/2605 "PR by @pascalbetz, merged 2021-04-26"
1768
1968
  [#2584]:https://github.com/puma/puma/issues/2584 "Issue by @kaorihinata, closed 2021-04-26"
1769
1969
  [#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"
1970
+ [#2552]:https://github.com/puma/puma/issues/2552 "Issue by @feliperaul, closed 2021-05-24"
1771
1971
  [#2606]:https://github.com/puma/puma/pull/2606 "PR by @wjordan, merged 2021-04-20"
1772
1972
  [#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"
1973
+ [#2567]:https://github.com/puma/puma/pull/2567 "PR by @kddnewton, merged 2021-04-19"
1974
+ [#2566]:https://github.com/puma/puma/issues/2566 "Issue by @kddnewton, closed 2021-04-19"
1775
1975
  [#2596]:https://github.com/puma/puma/pull/2596 "PR by @MSP-Greg, merged 2021-04-18"
1776
1976
  [#2588]:https://github.com/puma/puma/pull/2588 "PR by @dentarg, merged 2021-04-02"
1777
1977
  [#2556]:https://github.com/puma/puma/issues/2556 "Issue by @gamecreature, closed 2021-04-02"
@@ -1790,7 +1990,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1790
1990
  [#2519]:https://github.com/puma/puma/pull/2519 "PR by @MSP-Greg, merged 2021-01-26"
1791
1991
  [#2522]:https://github.com/puma/puma/pull/2522 "PR by @jcmfernandes, merged 2021-01-12"
1792
1992
  [#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"
1993
+ [#2486]:https://github.com/puma/puma/pull/2486 "PR by @karloscodes, merged 2020-12-02"
1794
1994
  [#2535]:https://github.com/puma/puma/pull/2535 "PR by @MSP-Greg, merged 2021-01-27"
1795
1995
  [#2529]:https://github.com/puma/puma/pull/2529 "PR by @MSP-Greg, merged 2021-01-24"
1796
1996
  [#2533]:https://github.com/puma/puma/pull/2533 "PR by @MSP-Greg, merged 2021-01-24"
@@ -1800,7 +2000,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1800
2000
  [#2521]:https://github.com/puma/puma/pull/2521 "PR by @ojab, merged 2021-01-04"
1801
2001
  [#2531]:https://github.com/puma/puma/pull/2531 "PR by @wjordan, merged 2021-01-19"
1802
2002
  [#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"
2003
+ [#2472]:https://github.com/puma/puma/pull/2472 "PR by @karloscodes, merged 2020-11-02"
1804
2004
  [#2438]:https://github.com/puma/puma/pull/2438 "PR by @ekohl, merged 2020-10-26"
1805
2005
  [#2406]:https://github.com/puma/puma/pull/2406 "PR by @fdel15, merged 2020-10-19"
1806
2006
  [#2449]:https://github.com/puma/puma/pull/2449 "PR by @MSP-Greg, merged 2020-10-28"
@@ -2227,7 +2427,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2227
2427
  [#709]:https://github.com/puma/puma/pull/709 "PR by @lian, merged 2015-06-10"
2228
2428
  [#711]:https://github.com/puma/puma/pull/711 "PR by @julik, merged 2015-06-10"
2229
2429
  [#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"
2430
+ [#715]:https://github.com/puma/puma/pull/715 "PR by @raymondmars, merged 2015-07-14"
2231
2431
  [#725]:https://github.com/puma/puma/pull/725 "PR by @rwz, merged 2015-07-14"
2232
2432
  [#726]:https://github.com/puma/puma/pull/726 "PR by @jshafton, merged 2015-07-14"
2233
2433
  [#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