unicorn 5.4.1 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.manifest +2 -0
- data/.olddoc.yml +1 -1
- data/Application_Timeouts +4 -4
- data/Documentation/unicorn.1.txt +1 -1
- data/Documentation/unicorn_rails.1.txt +1 -1
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/ISSUES +5 -2
- data/LATEST +22 -21
- data/LICENSE +2 -2
- data/Links +9 -7
- data/NEWS +42 -0
- data/README +13 -6
- data/Sandbox +2 -2
- data/bin/unicorn +3 -1
- data/examples/logrotate.conf +1 -1
- data/examples/nginx.conf +3 -2
- data/ext/unicorn_http/common_field_optimization.h +24 -6
- data/ext/unicorn_http/extconf.rb +30 -0
- data/ext/unicorn_http/global_variables.h +2 -2
- data/ext/unicorn_http/httpdate.c +2 -2
- data/ext/unicorn_http/unicorn_http.c +4 -9
- data/ext/unicorn_http/unicorn_http.rl +4 -9
- data/lib/unicorn/configurator.rb +12 -1
- data/lib/unicorn/http_request.rb +1 -2
- data/lib/unicorn/http_server.rb +7 -8
- data/lib/unicorn/launcher.rb +1 -1
- data/lib/unicorn/socket_helper.rb +1 -0
- data/lib/unicorn/util.rb +1 -1
- data/lib/unicorn/version.rb +1 -1
- data/lib/unicorn/worker.rb +16 -2
- data/lib/unicorn.rb +19 -8
- data/man/man1/unicorn.1 +1 -1
- data/man/man1/unicorn_rails.1 +1 -1
- data/t/README +4 -4
- data/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
- data/t/t0301.ru +13 -0
- data/test/unit/test_http_parser.rb +16 -0
- data/test/unit/test_util.rb +25 -0
- data/unicorn.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c37db62d1e413297803b2fac9be18b752b80b0068eeeafd1027eb2eae2a693c2
|
4
|
+
data.tar.gz: 0af88fc316857d8e0c4bc899de3d7994f54a01e5a9a8a25ad5a721cc669d6bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5788c3a37e65de0dbc12735f72af22a27638ada89f05c3e2904171662fd72ba3ef42d01efd3aa3bd8c3324a90c2b3b11fbd27835b7c8f32969b923a66dae9e65
|
7
|
+
data.tar.gz: 19928922c0e6068b4818d2111f9f0e47ffe071c22c68deb23c67a29c787c9e0f5e1e17d503c56b2e01f885aa9329ca04e5e7829ccf28e3d7cec14907f9b20736
|
data/.manifest
CHANGED
@@ -128,6 +128,8 @@ t/t0116-client_body_buffer_size.sh
|
|
128
128
|
t/t0116.ru
|
129
129
|
t/t0200-rack-hijack.sh
|
130
130
|
t/t0300-no-default-middleware.sh
|
131
|
+
t/t0301-no-default-middleware-ignored-in-config.sh
|
132
|
+
t/t0301.ru
|
131
133
|
t/t9000-preread-input.sh
|
132
134
|
t/t9001-oob_gc.sh
|
133
135
|
t/t9002-oob_gc-path.sh
|
data/.olddoc.yml
CHANGED
data/Application_Timeouts
CHANGED
@@ -23,10 +23,10 @@ Most database adapters allow configurable timeouts.
|
|
23
23
|
Net::HTTP and Net::SMTP in the Ruby standard library allow
|
24
24
|
configurable timeouts.
|
25
25
|
|
26
|
-
Even for things as fast as {memcached}[
|
27
|
-
{dalli}[
|
28
|
-
{memcached}[
|
29
|
-
{memcache-client}[
|
26
|
+
Even for things as fast as {memcached}[https://memcached.org/],
|
27
|
+
{dalli}[https://rubygems.org/gems/dalli],
|
28
|
+
{memcached}[https://rubygems.org/gems/memcached] and
|
29
|
+
{memcache-client}[https://rubygems.org/gems/memcache-client] RubyGems all
|
30
30
|
offer configurable timeouts.
|
31
31
|
|
32
32
|
Consult the relevant documentation for the libraries you use on
|
data/Documentation/unicorn.1.txt
CHANGED
@@ -182,6 +182,6 @@ the unicorn config file.
|
|
182
182
|
* [Rackup HowTo][3]
|
183
183
|
|
184
184
|
[1]: https://bogomips.org/unicorn/
|
185
|
-
[2]:
|
185
|
+
[2]: https://www.rubydoc.info/github/rack/rack/
|
186
186
|
[3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
|
187
187
|
[4]: https://bogomips.org/unicorn/SIGNALS.html
|
@@ -170,6 +170,6 @@ used by Unicorn.
|
|
170
170
|
* [Rackup HowTo][3]
|
171
171
|
|
172
172
|
[1]: https://bogomips.org/unicorn/
|
173
|
-
[2]:
|
173
|
+
[2]: https://www.rubydoc.info/github/rack/rack/
|
174
174
|
[3]: https://github.com/rack/rack/wiki/tutorial-rackup-howto
|
175
175
|
[4]: https://bogomips.org/unicorn/SIGNALS.html
|
data/GIT-VERSION-FILE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
GIT_VERSION = 5.
|
1
|
+
GIT_VERSION = 5.5.0
|
data/GIT-VERSION-GEN
CHANGED
data/ISSUES
CHANGED
@@ -39,6 +39,7 @@ https://bugs.ruby-lang.org/ and discuss+fix them on the ruby-core
|
|
39
39
|
list at mailto:ruby-core@ruby-lang.org
|
40
40
|
Subscription to post is required to ruby-core, unfortunately:
|
41
41
|
mailto:ruby-core-request@ruby-lang.org?subject=subscribe
|
42
|
+
Unofficial archives are available at: https://public-inbox.org/ruby-core/
|
42
43
|
|
43
44
|
For uncommon bugs in Rack, we may forward bugs to
|
44
45
|
mailto:rack-devel@googlegroups.com and discuss there.
|
@@ -46,6 +47,7 @@ Subscription (without any web UI or Google account) is possible via:
|
|
46
47
|
mailto:rack-devel+subscribe@googlegroups.com
|
47
48
|
Note: not everyone can use the proprietary bug tracker used by Rack,
|
48
49
|
but their mailing list remains operational.
|
50
|
+
Unofficial archives are available at: https://public-inbox.org/rack-devel/
|
49
51
|
|
50
52
|
Uncommon bugs we encounter in the Linux kernel should be Cc:-ed to the
|
51
53
|
Linux kernel mailing list (LKML) at mailto:linux-kernel@vger.kernel.org
|
@@ -54,11 +56,12 @@ and subsystem maintainers such as mailto:netdev@vger.kernel.org
|
|
54
56
|
involved with any problematic commits (including those in the
|
55
57
|
Signed-off-by: and other trailer lines). No subscription is necessary,
|
56
58
|
and the our mailing list follows the same conventions as LKML for
|
57
|
-
interopability.
|
58
|
-
ignored by most
|
59
|
+
interopability. Archives are available at https://lore.kernel.org/lkml/
|
60
|
+
There is a kernel.org Bugzilla instance, but it is ignored by most.
|
59
61
|
|
60
62
|
Likewise for any rare glibc bugs we might encounter, we should Cc:
|
61
63
|
mailto:libc-alpha@sourceware.org
|
64
|
+
Unofficial archives are available at: https://public-inbox.org/libc-alpha/
|
62
65
|
Keep in mind glibc upstream does use Bugzilla for tracking bugs:
|
63
66
|
https://sourceware.org/bugzilla/
|
64
67
|
|
data/LATEST
CHANGED
@@ -1,29 +1,30 @@
|
|
1
|
-
=== unicorn 5.
|
1
|
+
=== unicorn 5.5.0.pre1 / 2018-12-20 20:11 UTC
|
2
2
|
|
3
|
-
|
4
|
-
the Rack `env' privately without copying it (to avoid clobbering
|
5
|
-
by another client). Thanks to Sam Saffron for reporting and
|
6
|
-
testing this new feature:
|
7
|
-
https://bogomips.org/unicorn-public/CAAtdryPG3nLuyo0jxfYW1YHu1Q+ZpkLkd4KdWC8vA46B5haZxw@mail.gmail.com/T/
|
3
|
+
Jeremy Evans contributed the "default_middleware" configuration option:
|
8
4
|
|
9
|
-
|
10
|
-
relying on the "-d" CLI switch). Thanks to James P Robinson Jr
|
11
|
-
for reporting this bug:
|
12
|
-
https://bogomips.org/unicorn-public/D6324CB4.7BC3E%25james.robinson3@cigna.com/T/
|
13
|
-
(Coincidentally, this fix will be irrelevant for Ruby 2.5
|
14
|
-
which requires 'pp' by default)
|
5
|
+
https://bogomips.org/unicorn-public/20180913192055.GD48926@jeremyevans.local/
|
15
6
|
|
16
|
-
|
7
|
+
Jeremy also contributed the ability to use separate groups for the process
|
8
|
+
and log files:
|
17
9
|
|
18
|
-
|
10
|
+
https://bogomips.org/unicorn-public/20180913192449.GE48926@jeremyevans.local/
|
19
11
|
|
20
|
-
|
21
|
-
|
22
|
-
avoid reusing env on hijack
|
23
|
-
tests: cleanup some unused variable warnings
|
24
|
-
ISSUES: add a note about Debian BTS interopability
|
12
|
+
There's also a couple of uninteresting minor optimizations and
|
13
|
+
documentation additions.
|
25
14
|
|
26
|
-
|
15
|
+
Eric Wong (10):
|
16
|
+
remove random seed reset atfork
|
17
|
+
use IO#wait instead of kgio_wait_readable
|
18
|
+
Merge branch '5.4-stable'
|
19
|
+
shrink pipes under Linux
|
20
|
+
socket_helper: add hint for FreeBSD users for accf_http(9)
|
21
|
+
tests: ensure -N/--no-default-middleware not supported in config.ru
|
22
|
+
doc: update more URLs to use HTTPS and avoid redirects
|
23
|
+
deduplicate strings VM-wide in Ruby 2.5+
|
24
|
+
doc/ISSUES: add links to git clone-able mail archives of our dependencies
|
25
|
+
README: minor updates and additional disclaimer
|
27
26
|
|
28
|
-
|
27
|
+
Jeremy Evans (2):
|
28
|
+
Make Worker#user support different process primary group and log file group
|
29
|
+
Support default_middleware configuration option
|
29
30
|
|
data/LICENSE
CHANGED
@@ -8,8 +8,8 @@ any later version. We currently prefer the GPLv3 or later for
|
|
8
8
|
derivative works, but the GPLv2 is fine.
|
9
9
|
|
10
10
|
The complete texts of the GPLv2 and GPLv3 are below:
|
11
|
-
GPLv2 -
|
12
|
-
GPLv3 -
|
11
|
+
GPLv2 - https://www.gnu.org/licenses/gpl-2.0.txt
|
12
|
+
GPLv3 - https://www.gnu.org/licenses/gpl-3.0.txt
|
13
13
|
|
14
14
|
You may (against our _preference_) also use the Ruby 1.8 license terms
|
15
15
|
which we inherited from the original Mongrel project when we forked it:
|
data/Links
CHANGED
@@ -10,7 +10,7 @@ The unicorn project is not responsible for the content in these links.
|
|
10
10
|
Furthermore, the unicorn project has never, does not and will never endorse:
|
11
11
|
|
12
12
|
* any for-profit entities or services
|
13
|
-
* any non-{Free Software}[
|
13
|
+
* any non-{Free Software}[https://www.gnu.org/philosophy/free-sw.html]
|
14
14
|
|
15
15
|
The existence of these links does not imply endorsement of any entities
|
16
16
|
or services behind them.
|
@@ -31,26 +31,28 @@ or services behind them.
|
|
31
31
|
|
32
32
|
=== unicorn is written to work with
|
33
33
|
|
34
|
-
* {Rack}[
|
34
|
+
* {Rack}[https://rack.github.io/] - a minimal interface between webservers
|
35
35
|
supporting Ruby and Ruby frameworks
|
36
36
|
|
37
37
|
* {Ruby}[https://www.ruby-lang.org/en/] - the programming language of
|
38
38
|
Rack and unicorn
|
39
39
|
|
40
|
-
* {nginx}[
|
40
|
+
* {nginx}[https://nginx.org/] (Free versions) -
|
41
41
|
the reverse proxy for use with unicorn
|
42
42
|
|
43
43
|
=== Derivatives
|
44
44
|
|
45
|
-
* {Green Unicorn}[
|
45
|
+
* {Green Unicorn}[https://gunicorn.org/] - a Python version of unicorn
|
46
46
|
|
47
|
-
* {Starman}[
|
47
|
+
* {Starman}[https://metacpan.org/release/Starman/] - Plack/PSGI version
|
48
48
|
of unicorn
|
49
49
|
|
50
50
|
=== Prior Work
|
51
51
|
|
52
|
-
* {Mongrel}[
|
53
|
-
unicorn is based on
|
52
|
+
* {Mongrel}[https://rubygems.org/gems/mongrel] - the awesome webserver
|
53
|
+
unicorn is based on. A historical archive of the mongrel dev list
|
54
|
+
featuring early discussions of unicorn is available at:
|
55
|
+
https://bogomips.org/mongrel-devel/
|
54
56
|
|
55
57
|
* {david}[https://bogomips.org/david.git] - a tool to explain why you need
|
56
58
|
nginx in front of unicorn
|
data/NEWS
CHANGED
@@ -1,3 +1,45 @@
|
|
1
|
+
=== unicorn 5.5.0.pre1 / 2018-12-20 20:11 UTC
|
2
|
+
|
3
|
+
Jeremy Evans contributed the "default_middleware" configuration option:
|
4
|
+
|
5
|
+
https://bogomips.org/unicorn-public/20180913192055.GD48926@jeremyevans.local/
|
6
|
+
|
7
|
+
Jeremy also contributed the ability to use separate groups for the process
|
8
|
+
and log files:
|
9
|
+
|
10
|
+
https://bogomips.org/unicorn-public/20180913192449.GE48926@jeremyevans.local/
|
11
|
+
|
12
|
+
There's also a couple of uninteresting minor optimizations and
|
13
|
+
documentation additions.
|
14
|
+
|
15
|
+
Eric Wong (10):
|
16
|
+
remove random seed reset atfork
|
17
|
+
use IO#wait instead of kgio_wait_readable
|
18
|
+
Merge branch '5.4-stable'
|
19
|
+
shrink pipes under Linux
|
20
|
+
socket_helper: add hint for FreeBSD users for accf_http(9)
|
21
|
+
tests: ensure -N/--no-default-middleware not supported in config.ru
|
22
|
+
doc: update more URLs to use HTTPS and avoid redirects
|
23
|
+
deduplicate strings VM-wide in Ruby 2.5+
|
24
|
+
doc/ISSUES: add links to git clone-able mail archives of our dependencies
|
25
|
+
README: minor updates and additional disclaimer
|
26
|
+
|
27
|
+
Jeremy Evans (2):
|
28
|
+
Make Worker#user support different process primary group and log file group
|
29
|
+
Support default_middleware configuration option
|
30
|
+
|
31
|
+
=== unicorn 5.4.1 / 2018-07-23 17:13 UTC
|
32
|
+
|
33
|
+
This release quiets some warnings for Ruby 2.6 preview releases
|
34
|
+
and enables tests to pass under Ruby 1.9.3. Otherwise, nothing
|
35
|
+
interesting for Ruby 2.0..2.5 users. *YAWN*
|
36
|
+
|
37
|
+
Eric Wong (1):
|
38
|
+
quiet some mismatched indentation warnings
|
39
|
+
|
40
|
+
Fumiaki MATSUSHIMA (1):
|
41
|
+
Use IO#wait instead to fix test for Ruby 1.9
|
42
|
+
|
1
43
|
=== unicorn 5.4.0 / 2017-12-23 23:33 UTC
|
2
44
|
|
3
45
|
Rack hijack support improves as the app code can capture and use
|
data/README
CHANGED
@@ -10,7 +10,7 @@ both the the request and response in between unicorn and slow clients.
|
|
10
10
|
|
11
11
|
* Designed for Rack, Unix, fast clients, and ease-of-debugging. We
|
12
12
|
cut out everything that is better supported by the operating system,
|
13
|
-
{nginx}[
|
13
|
+
{nginx}[https://nginx.org/] or {Rack}[https://rack.github.io/].
|
14
14
|
|
15
15
|
* Compatible with Ruby 1.9.3 and later.
|
16
16
|
unicorn 4.x remains supported for Ruby 1.8 users.
|
@@ -37,12 +37,15 @@ both the the request and response in between unicorn and slow clients.
|
|
37
37
|
You can upgrade unicorn, your entire application, libraries
|
38
38
|
and even your Ruby interpreter without dropping clients.
|
39
39
|
|
40
|
+
* transparent upgrades using systemd socket activation is
|
41
|
+
supported since unicorn 5.0
|
42
|
+
|
40
43
|
* before_fork and after_fork hooks in case your application
|
41
44
|
has special needs when dealing with forked processes. These
|
42
45
|
should not be needed when the "preload_app" directive is
|
43
46
|
false (the default).
|
44
47
|
|
45
|
-
* Can be used with copy-on-write-friendly
|
48
|
+
* Can be used with copy-on-write-friendly GC in Ruby 2.0+
|
46
49
|
to save memory (by setting "preload_app" to true).
|
47
50
|
|
48
51
|
* Able to listen on multiple interfaces including UNIX sockets,
|
@@ -55,7 +58,7 @@ both the the request and response in between unicorn and slow clients.
|
|
55
58
|
|
56
59
|
== License
|
57
60
|
|
58
|
-
unicorn is copyright 2009-
|
61
|
+
unicorn is copyright 2009-2018 by all contributors (see logs in git).
|
59
62
|
It is based on Mongrel 1.1.5.
|
60
63
|
Mongrel is copyright 2007 Zed A. Shaw and contributors.
|
61
64
|
|
@@ -77,13 +80,13 @@ You may install it via RubyGems on RubyGems.org:
|
|
77
80
|
You can get the latest source via git from the following locations
|
78
81
|
(these versions may not be stable):
|
79
82
|
|
80
|
-
|
81
|
-
|
83
|
+
https://bogomips.org/unicorn.git
|
84
|
+
https://repo.or.cz/unicorn.git (mirror)
|
82
85
|
|
83
86
|
You may browse the code from the web:
|
84
87
|
|
85
88
|
* https://bogomips.org/unicorn.git
|
86
|
-
*
|
89
|
+
* https://repo.or.cz/w/unicorn.git (gitweb)
|
87
90
|
|
88
91
|
See the HACKING guide on how to contribute and build prerelease gems
|
89
92
|
from git.
|
@@ -122,6 +125,10 @@ unicorn is designed to only serve fast clients either on the local host
|
|
122
125
|
or a fast LAN. See the PHILOSOPHY and DESIGN documents for more details
|
123
126
|
regarding this.
|
124
127
|
|
128
|
+
Due to its ability to tolerate crashes and isolate clients, unicorn
|
129
|
+
is unfortunately known to prolong the existence of bugs in applications
|
130
|
+
and libraries which run on top of it.
|
131
|
+
|
125
132
|
== Contact
|
126
133
|
|
127
134
|
All feedback (bug reports, user/development dicussion, patches, pull
|
data/Sandbox
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Since unicorn includes executables and is usually used to start a Ruby
|
4
4
|
process, there are certain caveats to using it with tools that sandbox
|
5
5
|
RubyGems installations such as
|
6
|
-
{Bundler}[
|
6
|
+
{Bundler}[https://bundler.io/] or
|
7
7
|
{Isolate}[https://github.com/jbarnette/isolate].
|
8
8
|
|
9
9
|
== General deployment
|
@@ -66,7 +66,7 @@ before_exec hook as illustrated by https://gist.github.com/534668
|
|
66
66
|
Ruby 2.0.0 enforces FD_CLOEXEC on file descriptors by default. unicorn
|
67
67
|
has been prepared for this behavior since unicorn 4.1.0, and bundler
|
68
68
|
needs the "--keep-file-descriptors" option for "bundle exec":
|
69
|
-
|
69
|
+
https://bundler.io/man/bundle-exec.1.html
|
70
70
|
|
71
71
|
== Isolate
|
72
72
|
|
data/bin/unicorn
CHANGED
@@ -6,6 +6,7 @@ require 'optparse'
|
|
6
6
|
ENV["RACK_ENV"] ||= "development"
|
7
7
|
rackup_opts = Unicorn::Configurator::RACKUP
|
8
8
|
options = rackup_opts[:options]
|
9
|
+
set_no_default_middleware = true
|
9
10
|
|
10
11
|
op = OptionParser.new("", 24, ' ') do |opts|
|
11
12
|
cmd = File.basename($0)
|
@@ -60,7 +61,7 @@ op = OptionParser.new("", 24, ' ') do |opts|
|
|
60
61
|
|
61
62
|
opts.on("-N", "--no-default-middleware",
|
62
63
|
"do not load middleware implied by RACK_ENV") do |e|
|
63
|
-
rackup_opts[:no_default_middleware] = true
|
64
|
+
rackup_opts[:no_default_middleware] = true if set_no_default_middleware
|
64
65
|
end
|
65
66
|
|
66
67
|
opts.on("-D", "--daemonize", "run daemonized in the background") do |d|
|
@@ -110,6 +111,7 @@ op = OptionParser.new("", 24, ' ') do |opts|
|
|
110
111
|
opts.parse! ARGV
|
111
112
|
end
|
112
113
|
|
114
|
+
set_no_default_middleware = false
|
113
115
|
app = Unicorn.builder(ARGV[0] || 'config.ru', op)
|
114
116
|
op = nil
|
115
117
|
|
data/examples/logrotate.conf
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# /etc/logrotate.d/unicorn_app on my Debian systems
|
3
3
|
#
|
4
4
|
# See the logrotate(8) manpage for more information:
|
5
|
-
#
|
5
|
+
# https://linux.die.net/man/8/logrotate
|
6
6
|
#
|
7
7
|
# public logrotate-related discussion in our archives:
|
8
8
|
# https://bogomips.org/unicorn-public/?q=logrotate
|
data/examples/nginx.conf
CHANGED
@@ -56,7 +56,8 @@ http {
|
|
56
56
|
# to configure it all in one place here for static files and also
|
57
57
|
# to disable gzip for clients who don't get gzip/deflate right.
|
58
58
|
# There are other gzip settings that may be needed used to deal with
|
59
|
-
# bad clients out there, see
|
59
|
+
# bad clients out there, see
|
60
|
+
# https://nginx.org/en/docs/http/ngx_http_gzip_module.html
|
60
61
|
gzip on;
|
61
62
|
gzip_http_version 1.0;
|
62
63
|
gzip_proxied any;
|
@@ -117,7 +118,7 @@ http {
|
|
117
118
|
|
118
119
|
location @app {
|
119
120
|
# an HTTP header important enough to have its own Wikipedia entry:
|
120
|
-
#
|
121
|
+
# https://en.wikipedia.org/wiki/X-Forwarded-For
|
121
122
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
122
123
|
|
123
124
|
# enable this if you forward HTTPS traffic to unicorn,
|
@@ -58,26 +58,44 @@ static struct common_field common_http_fields[] = {
|
|
58
58
|
|
59
59
|
#define HTTP_PREFIX "HTTP_"
|
60
60
|
#define HTTP_PREFIX_LEN (sizeof(HTTP_PREFIX) - 1)
|
61
|
+
static ID id_uminus;
|
62
|
+
|
63
|
+
/* this dedupes under Ruby 2.5+ (December 2017) */
|
64
|
+
static VALUE str_dd_freeze(VALUE str)
|
65
|
+
{
|
66
|
+
if (STR_UMINUS_DEDUPE)
|
67
|
+
return rb_funcall(str, id_uminus, 0);
|
68
|
+
|
69
|
+
/* freeze,since it speeds up older MRI slightly */
|
70
|
+
OBJ_FREEZE(str);
|
71
|
+
return str;
|
72
|
+
}
|
73
|
+
|
74
|
+
static VALUE str_new_dd_freeze(const char *ptr, long len)
|
75
|
+
{
|
76
|
+
return str_dd_freeze(rb_str_new(ptr, len));
|
77
|
+
}
|
61
78
|
|
62
79
|
/* this function is not performance-critical, called only at load time */
|
63
|
-
static void init_common_fields(
|
80
|
+
static void init_common_fields(void)
|
64
81
|
{
|
65
82
|
int i;
|
66
83
|
struct common_field *cf = common_http_fields;
|
67
84
|
char tmp[64];
|
85
|
+
|
86
|
+
id_uminus = rb_intern("-@");
|
68
87
|
memcpy(tmp, HTTP_PREFIX, HTTP_PREFIX_LEN);
|
69
88
|
|
70
89
|
for(i = ARRAY_SIZE(common_http_fields); --i >= 0; cf++) {
|
71
90
|
/* Rack doesn't like certain headers prefixed with "HTTP_" */
|
72
91
|
if (!strcmp("CONTENT_LENGTH", cf->name) ||
|
73
92
|
!strcmp("CONTENT_TYPE", cf->name)) {
|
74
|
-
cf->value =
|
93
|
+
cf->value = str_new_dd_freeze(cf->name, cf->len);
|
75
94
|
} else {
|
76
95
|
memcpy(tmp + HTTP_PREFIX_LEN, cf->name, cf->len + 1);
|
77
|
-
cf->value =
|
96
|
+
cf->value = str_new_dd_freeze(tmp, HTTP_PREFIX_LEN + cf->len);
|
78
97
|
}
|
79
|
-
|
80
|
-
rb_ary_push(mark_ary, cf->value);
|
98
|
+
rb_gc_register_mark_object(cf->value);
|
81
99
|
}
|
82
100
|
}
|
83
101
|
|
@@ -105,7 +123,7 @@ static VALUE uncommon_field(const char *field, size_t flen)
|
|
105
123
|
memcpy(RSTRING_PTR(f) + HTTP_PREFIX_LEN, field, flen);
|
106
124
|
assert(*(RSTRING_PTR(f) + RSTRING_LEN(f)) == '\0' &&
|
107
125
|
"string didn't end with \\0"); /* paranoia */
|
108
|
-
return
|
126
|
+
return HASH_ASET_DEDUPE ? f : str_dd_freeze(f);
|
109
127
|
}
|
110
128
|
|
111
129
|
#endif /* common_field_optimization_h */
|
data/ext/unicorn_http/extconf.rb
CHANGED
@@ -8,4 +8,34 @@ have_func("rb_str_set_len", "ruby.h") or abort 'Ruby 1.9.3+ required'
|
|
8
8
|
have_func("rb_hash_clear", "ruby.h") # Ruby 2.0+
|
9
9
|
have_func("gmtime_r", "time.h")
|
10
10
|
|
11
|
+
message('checking if String#-@ (str_uminus) dedupes... ')
|
12
|
+
begin
|
13
|
+
a = -(%w(t e s t).join)
|
14
|
+
b = -(%w(t e s t).join)
|
15
|
+
if a.equal?(b)
|
16
|
+
$CPPFLAGS += ' -DSTR_UMINUS_DEDUPE=1 '
|
17
|
+
message("yes\n")
|
18
|
+
else
|
19
|
+
$CPPFLAGS += ' -DSTR_UMINUS_DEDUPE=0 '
|
20
|
+
message("no, needs Ruby 2.5+\n")
|
21
|
+
end
|
22
|
+
rescue NoMethodError
|
23
|
+
$CPPFLAGS += ' -DSTR_UMINUS_DEDUPE=0 '
|
24
|
+
message("no, String#-@ not available\n")
|
25
|
+
end
|
26
|
+
|
27
|
+
message('checking if Hash#[]= (rb_hash_aset) dedupes... ')
|
28
|
+
h = {}
|
29
|
+
x = {}
|
30
|
+
r = rand.to_s
|
31
|
+
h[%W(#{r}).join('')] = :foo
|
32
|
+
x[%W(#{r}).join('')] = :foo
|
33
|
+
if x.keys[0].equal?(h.keys[0])
|
34
|
+
$CPPFLAGS += ' -DHASH_ASET_DEDUPE=1 '
|
35
|
+
message("yes\n")
|
36
|
+
else
|
37
|
+
$CPPFLAGS += ' -DHASH_ASET_DEDUPE=0 '
|
38
|
+
message("no, needs Ruby 2.6+\n")
|
39
|
+
end
|
40
|
+
|
11
41
|
create_makefile("unicorn_http")
|
@@ -56,7 +56,7 @@ NORETURN(static void parser_raise(VALUE klass, const char *));
|
|
56
56
|
/** Defines global strings in the init method. */
|
57
57
|
#define DEF_GLOBAL(N, val) do { \
|
58
58
|
g_##N = rb_obj_freeze(rb_str_new(val, sizeof(val) - 1)); \
|
59
|
-
|
59
|
+
rb_gc_register_mark_object(g_##N); \
|
60
60
|
} while (0)
|
61
61
|
|
62
62
|
/* Defines the maximum allowed lengths for various input elements.*/
|
@@ -67,7 +67,7 @@ DEF_MAX_LENGTH(FRAGMENT, 1024); /* Don't know if this length is specified somewh
|
|
67
67
|
DEF_MAX_LENGTH(REQUEST_PATH, 4096); /* common PATH_MAX on modern systems */
|
68
68
|
DEF_MAX_LENGTH(QUERY_STRING, (1024 * 10));
|
69
69
|
|
70
|
-
static void init_globals(
|
70
|
+
static void init_globals(void)
|
71
71
|
{
|
72
72
|
DEF_GLOBAL(rack_url_scheme, "rack.url_scheme");
|
73
73
|
DEF_GLOBAL(request_method, "REQUEST_METHOD");
|
data/ext/unicorn_http/httpdate.c
CHANGED
@@ -64,13 +64,13 @@ static VALUE httpdate(VALUE self)
|
|
64
64
|
return buf;
|
65
65
|
}
|
66
66
|
|
67
|
-
void init_unicorn_httpdate(
|
67
|
+
void init_unicorn_httpdate(void)
|
68
68
|
{
|
69
69
|
VALUE mod = rb_define_module("Unicorn");
|
70
70
|
mod = rb_define_module_under(mod, "HttpResponse");
|
71
71
|
|
72
72
|
buf = rb_str_new(0, buf_capa - 1);
|
73
|
-
|
73
|
+
rb_gc_register_mark_object(buf);
|
74
74
|
buf_ptr = RSTRING_PTR(buf);
|
75
75
|
httpdate(Qnil);
|
76
76
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
#include "global_variables.h"
|
16
16
|
#include "c_util.h"
|
17
17
|
|
18
|
-
void init_unicorn_httpdate(
|
18
|
+
void init_unicorn_httpdate(void);
|
19
19
|
|
20
20
|
#define UH_FL_CHUNKED 0x1
|
21
21
|
#define UH_FL_HASBODY 0x2
|
@@ -4225,11 +4225,8 @@ static VALUE HttpParser_rssget(VALUE self)
|
|
4225
4225
|
|
4226
4226
|
void Init_unicorn_http(void)
|
4227
4227
|
{
|
4228
|
-
static VALUE mark_ary;
|
4229
4228
|
VALUE mUnicorn, cHttpParser;
|
4230
4229
|
|
4231
|
-
mark_ary = rb_ary_new();
|
4232
|
-
rb_global_variable(&mark_ary);
|
4233
4230
|
mUnicorn = rb_define_module("Unicorn");
|
4234
4231
|
cHttpParser = rb_define_class_under(mUnicorn, "HttpParser", rb_cObject);
|
4235
4232
|
eHttpParserError =
|
@@ -4239,7 +4236,7 @@ void Init_unicorn_http(void)
|
|
4239
4236
|
e414 = rb_define_class_under(mUnicorn, "RequestURITooLongError",
|
4240
4237
|
eHttpParserError);
|
4241
4238
|
|
4242
|
-
init_globals(
|
4239
|
+
init_globals();
|
4243
4240
|
rb_define_alloc_func(cHttpParser, HttpParser_alloc);
|
4244
4241
|
rb_define_method(cHttpParser, "initialize", HttpParser_init, 0);
|
4245
4242
|
rb_define_method(cHttpParser, "clear", HttpParser_clear, 0);
|
@@ -4276,16 +4273,14 @@ void Init_unicorn_http(void)
|
|
4276
4273
|
|
4277
4274
|
rb_define_singleton_method(cHttpParser, "max_header_len=", set_maxhdrlen, 1);
|
4278
4275
|
|
4279
|
-
init_common_fields(
|
4276
|
+
init_common_fields();
|
4280
4277
|
SET_GLOBAL(g_http_host, "HOST");
|
4281
4278
|
SET_GLOBAL(g_http_trailer, "TRAILER");
|
4282
4279
|
SET_GLOBAL(g_http_transfer_encoding, "TRANSFER_ENCODING");
|
4283
4280
|
SET_GLOBAL(g_content_length, "CONTENT_LENGTH");
|
4284
4281
|
SET_GLOBAL(g_http_connection, "CONNECTION");
|
4285
4282
|
id_set_backtrace = rb_intern("set_backtrace");
|
4286
|
-
init_unicorn_httpdate(
|
4287
|
-
|
4288
|
-
OBJ_FREEZE(mark_ary);
|
4283
|
+
init_unicorn_httpdate();
|
4289
4284
|
|
4290
4285
|
#ifndef HAVE_RB_HASH_CLEAR
|
4291
4286
|
id_clear = rb_intern("clear");
|
@@ -13,7 +13,7 @@
|
|
13
13
|
#include "global_variables.h"
|
14
14
|
#include "c_util.h"
|
15
15
|
|
16
|
-
void init_unicorn_httpdate(
|
16
|
+
void init_unicorn_httpdate(void);
|
17
17
|
|
18
18
|
#define UH_FL_CHUNKED 0x1
|
19
19
|
#define UH_FL_HASBODY 0x2
|
@@ -931,11 +931,8 @@ static VALUE HttpParser_rssget(VALUE self)
|
|
931
931
|
|
932
932
|
void Init_unicorn_http(void)
|
933
933
|
{
|
934
|
-
static VALUE mark_ary;
|
935
934
|
VALUE mUnicorn, cHttpParser;
|
936
935
|
|
937
|
-
mark_ary = rb_ary_new();
|
938
|
-
rb_global_variable(&mark_ary);
|
939
936
|
mUnicorn = rb_define_module("Unicorn");
|
940
937
|
cHttpParser = rb_define_class_under(mUnicorn, "HttpParser", rb_cObject);
|
941
938
|
eHttpParserError =
|
@@ -945,7 +942,7 @@ void Init_unicorn_http(void)
|
|
945
942
|
e414 = rb_define_class_under(mUnicorn, "RequestURITooLongError",
|
946
943
|
eHttpParserError);
|
947
944
|
|
948
|
-
init_globals(
|
945
|
+
init_globals();
|
949
946
|
rb_define_alloc_func(cHttpParser, HttpParser_alloc);
|
950
947
|
rb_define_method(cHttpParser, "initialize", HttpParser_init, 0);
|
951
948
|
rb_define_method(cHttpParser, "clear", HttpParser_clear, 0);
|
@@ -982,16 +979,14 @@ void Init_unicorn_http(void)
|
|
982
979
|
|
983
980
|
rb_define_singleton_method(cHttpParser, "max_header_len=", set_maxhdrlen, 1);
|
984
981
|
|
985
|
-
init_common_fields(
|
982
|
+
init_common_fields();
|
986
983
|
SET_GLOBAL(g_http_host, "HOST");
|
987
984
|
SET_GLOBAL(g_http_trailer, "TRAILER");
|
988
985
|
SET_GLOBAL(g_http_transfer_encoding, "TRANSFER_ENCODING");
|
989
986
|
SET_GLOBAL(g_content_length, "CONTENT_LENGTH");
|
990
987
|
SET_GLOBAL(g_http_connection, "CONNECTION");
|
991
988
|
id_set_backtrace = rb_intern("set_backtrace");
|
992
|
-
init_unicorn_httpdate(
|
993
|
-
|
994
|
-
OBJ_FREEZE(mark_ary);
|
989
|
+
init_unicorn_httpdate();
|
995
990
|
|
996
991
|
#ifndef HAVE_RB_HASH_CLEAR
|
997
992
|
id_clear = rb_intern("clear");
|
data/lib/unicorn/configurator.rb
CHANGED
@@ -88,6 +88,9 @@ class Unicorn::Configurator
|
|
88
88
|
RACKUP[:set_listener] and
|
89
89
|
set[:listeners] << "#{RACKUP[:host]}:#{RACKUP[:port]}"
|
90
90
|
|
91
|
+
RACKUP[:no_default_middleware] and
|
92
|
+
set[:default_middleware] = false
|
93
|
+
|
91
94
|
# unicorn_rails creates dirs here after working_directory is bound
|
92
95
|
after_reload.call if after_reload
|
93
96
|
|
@@ -235,7 +238,7 @@ class Unicorn::Configurator
|
|
235
238
|
# server 192.168.0.9:8080 fail_timeout=0;
|
236
239
|
# }
|
237
240
|
#
|
238
|
-
# See
|
241
|
+
# See https://nginx.org/en/docs/http/ngx_http_upstream_module.html
|
239
242
|
# for more details on nginx upstream configuration.
|
240
243
|
def timeout(seconds)
|
241
244
|
set_int(:timeout, seconds, 3)
|
@@ -265,6 +268,14 @@ class Unicorn::Configurator
|
|
265
268
|
set_int(:worker_processes, nr, 1)
|
266
269
|
end
|
267
270
|
|
271
|
+
# sets whether to add default middleware in the development and
|
272
|
+
# deployment RACK_ENVs.
|
273
|
+
#
|
274
|
+
# default_middleware is only available in unicorn 5.5.0+
|
275
|
+
def default_middleware(bool)
|
276
|
+
set_bool(:default_middleware, bool)
|
277
|
+
end
|
278
|
+
|
268
279
|
# sets listeners to the given +addresses+, replacing or augmenting the
|
269
280
|
# current set. This is for the global listener pool shared by all
|
270
281
|
# worker processes. For per-worker listeners, see the after_fork example
|
data/lib/unicorn/http_request.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
# :enddoc:
|
3
3
|
# no stable API here
|
4
4
|
require 'unicorn_http'
|
5
|
-
require 'raindrops'
|
6
5
|
|
7
6
|
# TODO: remove redundant names
|
8
7
|
Unicorn.const_set(:HttpRequest, Unicorn::HttpParser)
|
@@ -66,7 +65,7 @@ class Unicorn::HttpParser
|
|
66
65
|
clear
|
67
66
|
e = env
|
68
67
|
|
69
|
-
# From
|
68
|
+
# From https://www.ietf.org/rfc/rfc3875:
|
70
69
|
# "Script authors should be aware that the REMOTE_ADDR and
|
71
70
|
# REMOTE_HOST meta-variables (see sections 4.1.8 and 4.1.9)
|
72
71
|
# may not identify the ultimate source of the request. They
|
data/lib/unicorn/http_server.rb
CHANGED
@@ -14,7 +14,8 @@ class Unicorn::HttpServer
|
|
14
14
|
attr_accessor :app, :timeout, :worker_processes,
|
15
15
|
:before_fork, :after_fork, :before_exec,
|
16
16
|
:listener_opts, :preload_app,
|
17
|
-
:orig_app, :config, :ready_pipe, :user
|
17
|
+
:orig_app, :config, :ready_pipe, :user,
|
18
|
+
:default_middleware
|
18
19
|
attr_writer :after_worker_exit, :after_worker_ready, :worker_exec
|
19
20
|
|
20
21
|
attr_reader :pid, :logger
|
@@ -70,6 +71,7 @@ class Unicorn::HttpServer
|
|
70
71
|
@app = app
|
71
72
|
@request = Unicorn::HttpRequest.new
|
72
73
|
@reexec_pid = 0
|
74
|
+
@default_middleware = true
|
73
75
|
options = options.dup
|
74
76
|
@ready_pipe = options.delete(:ready_pipe)
|
75
77
|
@init_listeners = options[:listeners] ? options[:listeners].dup : []
|
@@ -82,7 +84,7 @@ class Unicorn::HttpServer
|
|
82
84
|
# * The master process never closes or reinitializes this once
|
83
85
|
# initialized. Signal handlers in the master process will write to
|
84
86
|
# it to wake up the master from IO.select in exactly the same manner
|
85
|
-
# djb describes in
|
87
|
+
# djb describes in https://cr.yp.to/docs/selfpipe.html
|
86
88
|
#
|
87
89
|
# * The workers immediately close the pipe they inherit. See the
|
88
90
|
# Unicorn::Worker class for the pipe workers use.
|
@@ -380,7 +382,7 @@ class Unicorn::HttpServer
|
|
380
382
|
|
381
383
|
# wait for a signal hander to wake us up and then consume the pipe
|
382
384
|
def master_sleep(sec)
|
383
|
-
@self_pipe[0].
|
385
|
+
@self_pipe[0].wait(sec) or return
|
384
386
|
# 11 bytes is the maximum string length which can be embedded within
|
385
387
|
# the Ruby itself and not require a separate malloc (on 32-bit MRI 1.9+).
|
386
388
|
# Most reads are only one byte here and uncommon, so it's not worth a
|
@@ -520,9 +522,6 @@ class Unicorn::HttpServer
|
|
520
522
|
Unicorn::Configurator::RACKUP.clear
|
521
523
|
@ready_pipe = @init_listeners = @before_exec = @before_fork = nil
|
522
524
|
|
523
|
-
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/36450
|
524
|
-
srand # remove in unicorn 6
|
525
|
-
|
526
525
|
# The OpenSSL PRNG is seeded with only the pid, and apps with frequently
|
527
526
|
# dying workers can recycle pids
|
528
527
|
OpenSSL::Random.seed(rand.to_s) if defined?(OpenSSL::Random)
|
@@ -787,12 +786,12 @@ class Unicorn::HttpServer
|
|
787
786
|
end
|
788
787
|
|
789
788
|
def build_app!
|
790
|
-
if app.respond_to?(:arity) && app.arity == 0
|
789
|
+
if app.respond_to?(:arity) && (app.arity == 0 || app.arity == 2)
|
791
790
|
if defined?(Gem) && Gem.respond_to?(:refresh)
|
792
791
|
logger.info "Refreshing Gem list"
|
793
792
|
Gem.refresh
|
794
793
|
end
|
795
|
-
self.app = app.call
|
794
|
+
self.app = app.arity == 0 ? app.call : app.call(nil, self)
|
796
795
|
end
|
797
796
|
end
|
798
797
|
|
data/lib/unicorn/launcher.rb
CHANGED
data/lib/unicorn/util.rb
CHANGED
@@ -64,7 +64,7 @@ module Unicorn::Util # :nodoc:
|
|
64
64
|
fp.reopen(fp.path, "a")
|
65
65
|
else
|
66
66
|
# We should not need this workaround, Ruby can be fixed:
|
67
|
-
#
|
67
|
+
# https://bugs.ruby-lang.org/issues/9036
|
68
68
|
# MRI will not call call fclose(3) or freopen(3) here
|
69
69
|
# since there's no associated std{in,out,err} FILE * pointer
|
70
70
|
# This should atomically use dup3(2) (or dup2(2)) syscall
|
data/lib/unicorn/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Unicorn::Const::UNICORN_VERSION = '5.
|
1
|
+
Unicorn::Const::UNICORN_VERSION = '5.5.0'
|
data/lib/unicorn/worker.rb
CHANGED
@@ -122,6 +122,11 @@ class Unicorn::Worker
|
|
122
122
|
# the +after_fork+ hook after any privileged functions need to be
|
123
123
|
# run (e.g. to set per-worker CPU affinity, niceness, etc)
|
124
124
|
#
|
125
|
+
# +group+ can be specified as a string, or as an array of two
|
126
|
+
# strings. If an array of two strings is given, the first string
|
127
|
+
# is used as the primary group of the process, and the second is
|
128
|
+
# used as the group of the log files.
|
129
|
+
#
|
125
130
|
# Any and all errors raised within this method will be propagated
|
126
131
|
# directly back to the caller (usually the +after_fork+ hook.
|
127
132
|
# These errors commonly include ArgumentError for specifying an
|
@@ -134,8 +139,17 @@ class Unicorn::Worker
|
|
134
139
|
# insufficient because modern systems have fine-grained
|
135
140
|
# capabilities. Let the caller handle any and all errors.
|
136
141
|
uid = Etc.getpwnam(user).uid
|
137
|
-
|
138
|
-
|
142
|
+
|
143
|
+
if group
|
144
|
+
if group.is_a?(Array)
|
145
|
+
group, log_group = group
|
146
|
+
log_gid = Etc.getgrnam(log_group).gid
|
147
|
+
end
|
148
|
+
gid = Etc.getgrnam(group).gid
|
149
|
+
log_gid ||= gid
|
150
|
+
end
|
151
|
+
|
152
|
+
Unicorn::Util.chown_logs(uid, log_gid)
|
139
153
|
if gid && Process.egid != gid
|
140
154
|
Process.initgroups(user, gid)
|
141
155
|
Process::GID.change_privilege(gid)
|
data/lib/unicorn.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
require 'etc'
|
3
3
|
require 'stringio'
|
4
4
|
require 'kgio'
|
5
|
+
require 'raindrops'
|
6
|
+
require 'io/wait'
|
5
7
|
|
6
8
|
begin
|
7
9
|
require 'rack'
|
@@ -43,12 +45,8 @@ module Unicorn
|
|
43
45
|
abort "rack and Rack::Builder must be available for processing #{ru}"
|
44
46
|
end
|
45
47
|
|
46
|
-
# Op is going to get cleared before the returned lambda is called, so
|
47
|
-
# save this value so that it's still there when we need it:
|
48
|
-
no_default_middleware = op[:no_default_middleware]
|
49
|
-
|
50
48
|
# always called after config file parsing, may be called after forking
|
51
|
-
lambda do
|
49
|
+
lambda do |_, server|
|
52
50
|
inner_app = case ru
|
53
51
|
when /\.ru$/
|
54
52
|
raw = File.read(ru)
|
@@ -64,7 +62,7 @@ module Unicorn
|
|
64
62
|
pp({ :inner_app => inner_app })
|
65
63
|
end
|
66
64
|
|
67
|
-
return inner_app
|
65
|
+
return inner_app unless server.default_middleware
|
68
66
|
|
69
67
|
middleware = { # order matters
|
70
68
|
ContentLength: nil,
|
@@ -112,9 +110,22 @@ module Unicorn
|
|
112
110
|
exc.backtrace.each { |line| logger.error(line) }
|
113
111
|
end
|
114
112
|
|
115
|
-
|
113
|
+
F_SETPIPE_SZ = 1031 if RUBY_PLATFORM =~ /linux/
|
114
|
+
|
116
115
|
def self.pipe # :nodoc:
|
117
|
-
Kgio::Pipe.new.each
|
116
|
+
Kgio::Pipe.new.each do |io|
|
117
|
+
io.close_on_exec = true # remove this when we only support Ruby >= 2.0
|
118
|
+
|
119
|
+
# shrink pipes to minimize impact on /proc/sys/fs/pipe-user-pages-soft
|
120
|
+
# limits.
|
121
|
+
if defined?(F_SETPIPE_SZ)
|
122
|
+
begin
|
123
|
+
io.fcntl(F_SETPIPE_SZ, Raindrops::PAGE_SIZE)
|
124
|
+
rescue Errno::EINVAL
|
125
|
+
# old kernel
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
118
129
|
end
|
119
130
|
# :startdoc:
|
120
131
|
end
|
data/man/man1/unicorn.1
CHANGED
@@ -214,7 +214,7 @@ the unicorn config file.
|
|
214
214
|
.IP \[bu] 2
|
215
215
|
Unicorn RDoc (https://bogomips.org/unicorn/)
|
216
216
|
.IP \[bu] 2
|
217
|
-
Rack RDoc (
|
217
|
+
Rack RDoc (https://www.rubydoc.info/github/rack/rack/)
|
218
218
|
.IP \[bu] 2
|
219
219
|
Rackup HowTo (https://github.com/rack/rack/wiki/tutorial-rackup-howto)
|
220
220
|
.SH AUTHORS
|
data/man/man1/unicorn_rails.1
CHANGED
@@ -205,7 +205,7 @@ unicorn(1)
|
|
205
205
|
.IP \[bu] 2
|
206
206
|
Unicorn RDoc (https://bogomips.org/unicorn/)
|
207
207
|
.IP \[bu] 2
|
208
|
-
Rack RDoc (
|
208
|
+
Rack RDoc (https://www.rubydoc.info/github/rack/rack/)
|
209
209
|
.IP \[bu] 2
|
210
210
|
Rackup HowTo (https://github.com/rack/rack/wiki/tutorial-rackup-howto)
|
211
211
|
.SH AUTHORS
|
data/t/README
CHANGED
@@ -10,17 +10,17 @@ comfortable writing integration tests with.
|
|
10
10
|
|
11
11
|
== Requirements
|
12
12
|
|
13
|
-
* {Ruby 1.9.3+}[https://www.ruby-lang.org/] (duh!)
|
14
|
-
* {GNU make}[
|
13
|
+
* {Ruby 1.9.3+}[https://www.ruby-lang.org/en/] (duh!)
|
14
|
+
* {GNU make}[https://www.gnu.org/software/make/]
|
15
15
|
* {socat}[http://www.dest-unreach.org/socat/]
|
16
|
-
* {curl}[
|
16
|
+
* {curl}[https://curl.haxx.se/]
|
17
17
|
* standard UNIX shell utilities (Bourne sh, awk, sed, grep, ...)
|
18
18
|
|
19
19
|
We do not use bashisms or any non-portable, non-POSIX constructs
|
20
20
|
in our shell code. We use the "pipefail" option if available and
|
21
21
|
mainly test with {ksh}[http://kornshell.com/], but occasionally
|
22
22
|
with {dash}[http://gondor.apana.org.au/~herbert/dash/] and
|
23
|
-
{bash}[
|
23
|
+
{bash}[https://www.gnu.org/software/bash/], too.
|
24
24
|
|
25
25
|
== Running Tests
|
26
26
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
. ./test-lib.sh
|
3
|
+
t_plan 3 "-N / --no-default-middleware option not supported in config.ru"
|
4
|
+
|
5
|
+
t_begin "setup and start" && {
|
6
|
+
unicorn_setup
|
7
|
+
RACK_ENV=development unicorn -D -c $unicorn_config t0301.ru
|
8
|
+
unicorn_wait_start
|
9
|
+
}
|
10
|
+
|
11
|
+
t_begin "check switches parsed as expected and -N ignored for Rack::Lint" && {
|
12
|
+
debug=false
|
13
|
+
lint=
|
14
|
+
eval "$(curl -sf http://$listen/vars)"
|
15
|
+
test x"$debug" = xtrue
|
16
|
+
test x"$lint" != x
|
17
|
+
test -f "$lint"
|
18
|
+
}
|
19
|
+
|
20
|
+
t_begin "killing succeeds" && {
|
21
|
+
kill $unicorn_pid
|
22
|
+
check_stderr
|
23
|
+
}
|
24
|
+
|
25
|
+
t_done
|
data/t/t0301.ru
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#\-N --debug
|
2
|
+
run(lambda do |env|
|
3
|
+
case env['PATH_INFO']
|
4
|
+
when '/vars'
|
5
|
+
b = "debug=#{$DEBUG.inspect}\n" \
|
6
|
+
"lint=#{caller.grep(%r{rack/lint\.rb})[0].split(':')[0]}\n"
|
7
|
+
end
|
8
|
+
h = {
|
9
|
+
'Content-Length' => b.size.to_s,
|
10
|
+
'Content-Type' => 'text/plain',
|
11
|
+
}
|
12
|
+
[ 200, h, [ b ] ]
|
13
|
+
end)
|
@@ -865,4 +865,20 @@ class HttpParserTest < Test::Unit::TestCase
|
|
865
865
|
rescue LoadError
|
866
866
|
# not all Ruby implementations have objspace
|
867
867
|
end
|
868
|
+
|
869
|
+
def test_dedupe
|
870
|
+
parser = HttpParser.new
|
871
|
+
# n.b. String#freeze optimization doesn't work under modern test-unit
|
872
|
+
exp = -'HTTP_HOST'
|
873
|
+
get = "GET / HTTP/1.1\r\nHost: example.com\r\nHavpbea-fhpxf: true\r\n\r\n"
|
874
|
+
assert parser.add_parse(get)
|
875
|
+
key = parser.env.keys.detect { |k| k == exp }
|
876
|
+
assert_same exp, key
|
877
|
+
|
878
|
+
if RUBY_VERSION.to_r >= 2.6 # 2.6.0-rc1+
|
879
|
+
exp = -'HTTP_HAVPBEA_FHPXF'
|
880
|
+
key = parser.env.keys.detect { |k| k == exp }
|
881
|
+
assert_same exp, key
|
882
|
+
end
|
883
|
+
end if RUBY_VERSION.to_r >= 2.5 && RUBY_ENGINE == 'ruby'
|
868
884
|
end
|
data/test/unit/test_util.rb
CHANGED
@@ -102,4 +102,29 @@ class TestUtil < Test::Unit::TestCase
|
|
102
102
|
}
|
103
103
|
tmp.close!
|
104
104
|
end
|
105
|
+
|
106
|
+
def test_pipe
|
107
|
+
r, w = Unicorn.pipe
|
108
|
+
assert r
|
109
|
+
assert w
|
110
|
+
|
111
|
+
return if RUBY_PLATFORM !~ /linux/
|
112
|
+
|
113
|
+
begin
|
114
|
+
f_getpipe_sz = 1032
|
115
|
+
IO.pipe do |a, b|
|
116
|
+
a_sz = a.fcntl(f_getpipe_sz)
|
117
|
+
b_sz = b.fcntl(f_getpipe_sz)
|
118
|
+
assert_kind_of Integer, a_sz
|
119
|
+
r_sz = r.fcntl(f_getpipe_sz)
|
120
|
+
assert_equal Raindrops::PAGE_SIZE, r_sz
|
121
|
+
assert_operator a_sz, :>=, r_sz
|
122
|
+
end
|
123
|
+
rescue Errno::EINVAL
|
124
|
+
# Linux <= 2.6.34
|
125
|
+
end
|
126
|
+
ensure
|
127
|
+
w.close
|
128
|
+
r.close
|
129
|
+
end
|
105
130
|
end
|
data/unicorn.gemspec
CHANGED
@@ -11,7 +11,7 @@ end.compact
|
|
11
11
|
|
12
12
|
Gem::Specification.new do |s|
|
13
13
|
s.name = %q{unicorn}
|
14
|
-
s.version = (ENV['VERSION'] || '5.
|
14
|
+
s.version = (ENV['VERSION'] || '5.5.0').dup
|
15
15
|
s.authors = ['unicorn hackers']
|
16
16
|
s.summary = 'Rack HTTP server for fast clients and Unix'
|
17
17
|
s.description = File.read('README').split("\n\n")[1]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unicorn hackers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -238,6 +238,8 @@ files:
|
|
238
238
|
- t/t0116.ru
|
239
239
|
- t/t0200-rack-hijack.sh
|
240
240
|
- t/t0300-no-default-middleware.sh
|
241
|
+
- t/t0301-no-default-middleware-ignored-in-config.sh
|
242
|
+
- t/t0301.ru
|
241
243
|
- t/t9000-preread-input.sh
|
242
244
|
- t/t9001-oob_gc.sh
|
243
245
|
- t/t9002-oob_gc-path.sh
|
@@ -287,8 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
289
|
- !ruby/object:Gem::Version
|
288
290
|
version: '0'
|
289
291
|
requirements: []
|
290
|
-
|
291
|
-
rubygems_version: 2.7.7
|
292
|
+
rubygems_version: 3.0.2
|
292
293
|
signing_key:
|
293
294
|
specification_version: 4
|
294
295
|
summary: Rack HTTP server for fast clients and Unix
|