unicorn 5.5.1 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.olddoc.yml +12 -7
- data/Documentation/.gitignore +1 -3
- data/Documentation/unicorn.1 +222 -0
- data/Documentation/unicorn_rails.1 +207 -0
- data/FAQ +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +15 -5
- data/HACKING +1 -1
- data/ISSUES +12 -12
- data/KNOWN_ISSUES +2 -2
- data/Links +5 -5
- data/README +6 -6
- data/SIGNALS +1 -1
- data/Sandbox +2 -2
- data/archive/slrnpull.conf +1 -1
- data/examples/big_app_gc.rb +1 -1
- data/examples/logrotate.conf +2 -2
- data/examples/nginx.conf +1 -1
- data/examples/unicorn.conf.minimal.rb +2 -2
- data/examples/unicorn.conf.rb +2 -2
- data/examples/unicorn@.service +7 -0
- data/ext/unicorn_http/unicorn_http.rl +43 -5
- data/lib/unicorn.rb +1 -1
- data/lib/unicorn/configurator.rb +13 -3
- data/lib/unicorn/http_request.rb +11 -0
- data/lib/unicorn/http_server.rb +32 -4
- data/lib/unicorn/oob_gc.rb +2 -2
- data/lib/unicorn/tmpio.rb +8 -2
- data/test/benchmark/README +14 -4
- data/test/benchmark/ddstream.ru +50 -0
- data/test/benchmark/readinput.ru +40 -0
- data/test/benchmark/uconnect.perl +66 -0
- data/test/exec/test_exec.rb +9 -7
- data/test/test_helper.rb +0 -26
- data/test/unit/test_http_parser_ng.rb +81 -0
- data/test/unit/test_server.rb +30 -0
- data/test/unit/test_upload.rb +4 -9
- data/test/unit/test_util.rb +1 -1
- data/unicorn.gemspec +3 -3
- metadata +10 -7
- data/Documentation/GNUmakefile +0 -30
- data/Documentation/unicorn.1.txt +0 -187
- data/Documentation/unicorn_rails.1.txt +0 -173
data/FAQ
CHANGED
@@ -7,7 +7,7 @@ drained entirely by the application. This may happen when request
|
|
7
7
|
bodies are gzipped, as unicorn reads request body data lazily to avoid
|
8
8
|
overhead from bad requests.
|
9
9
|
|
10
|
-
Ref: https://
|
10
|
+
Ref: https://yhbt.net/unicorn-public/FC91211E-FD32-432C-92FC-0318714C2170@zendesk.com/
|
11
11
|
|
12
12
|
=== Why aren't my Rails log files rotated when I use SIGUSR1?
|
13
13
|
|
data/GIT-VERSION-GEN
CHANGED
data/GNUmakefile
CHANGED
@@ -150,13 +150,23 @@ prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
|
|
150
150
|
|
151
151
|
clean:
|
152
152
|
-$(MAKE) -C $(ext) clean
|
153
|
-
-$(MAKE) -C Documentation clean
|
154
153
|
$(RM) $(ext)/Makefile
|
155
154
|
$(RM) $(setup_rb_files) $(t_log)
|
156
155
|
$(RM) -r $(test_prefix) man
|
156
|
+
$(RM) $(man1) $(html1)
|
157
157
|
|
158
|
-
|
159
|
-
|
158
|
+
man1 := $(addprefix Documentation/, unicorn.1 unicorn_rails.1)
|
159
|
+
html1 := $(addsuffix .html, $(man1))
|
160
|
+
man :
|
161
|
+
mkdir -p man/man1
|
162
|
+
install -m 644 $(man1) man/man1
|
163
|
+
|
164
|
+
html : $(html1)
|
165
|
+
mkdir -p doc/man1
|
166
|
+
install -m 644 $(html1) doc/man1
|
167
|
+
|
168
|
+
%.1.html: %.1
|
169
|
+
$(OLDDOC) man2html -o $@ ./$<
|
160
170
|
|
161
171
|
pkg_extra := GIT-VERSION-FILE lib/unicorn/version.rb LATEST NEWS \
|
162
172
|
$(ext)/unicorn_http.c $(man1_paths)
|
@@ -183,13 +193,13 @@ doc: .document $(ext)/unicorn_http.c man html .olddoc.yml $(PLACEHOLDERS)
|
|
183
193
|
install -m644 $(man1_paths) doc/
|
184
194
|
tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
|
185
195
|
|
186
|
-
# publishes docs to https://
|
196
|
+
# publishes docs to https://yhbt.net/unicorn/
|
187
197
|
publish_doc:
|
188
198
|
-git set-file-times
|
189
199
|
$(MAKE) doc
|
190
200
|
$(MAKE) doc_gz
|
191
201
|
chmod 644 $$(find doc -type f)
|
192
|
-
$(RSYNC) -av doc/
|
202
|
+
$(RSYNC) -av doc/ yhbt.net:/srv/yhbt/unicorn/
|
193
203
|
git ls-files | xargs touch
|
194
204
|
|
195
205
|
# Create gzip variants of the same timestamp as the original so nginx
|
data/HACKING
CHANGED
@@ -57,7 +57,7 @@ Please wrap documentation at 72 characters-per-line or less (long URLs
|
|
57
57
|
are exempt) so it is comfortably readable from terminals.
|
58
58
|
|
59
59
|
When referencing mailing list posts, use
|
60
|
-
<tt>https://
|
60
|
+
<tt>https://yhbt.net/unicorn-public/$MESSAGE_ID/</tt> if possible
|
61
61
|
since the Message-ID remains searchable even if a particular site
|
62
62
|
becomes unavailable.
|
63
63
|
|
data/ISSUES
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
= Issues
|
2
2
|
|
3
|
-
mailto:unicorn-public@
|
3
|
+
mailto:unicorn-public@yhbt.net is the best place to report bugs,
|
4
4
|
submit patches and/or obtain support after you have searched the
|
5
|
-
{email archives}[https://
|
6
|
-
{documentation}[https://
|
5
|
+
{email archives}[https://yhbt.net/unicorn-public/] and
|
6
|
+
{documentation}[https://yhbt.net/unicorn/].
|
7
7
|
|
8
8
|
* No subscription will ever be required to email us
|
9
9
|
* Cc: all participants in a thread or commit, as subscription is optional
|
@@ -12,12 +12,12 @@ submit patches and/or obtain support after you have searched the
|
|
12
12
|
* Do not send HTML mail or images,
|
13
13
|
they hurt reader privacy and will be flagged as spam
|
14
14
|
* Anonymous and pseudonymous messages will ALWAYS be welcome
|
15
|
-
* The email submission port (587) is enabled on the
|
16
|
-
https://
|
15
|
+
* The email submission port (587) is enabled on the yhbt.net MX:
|
16
|
+
https://yhbt.net/unicorn-public/20141004232241.GA23908@dcvr.yhbt.net/t/
|
17
17
|
|
18
18
|
We will never have a centralized or formal bug tracker. Instead we
|
19
19
|
can interoperate with any bug tracker which can Cc: us plain-text to
|
20
|
-
mailto:unicorn-public@
|
20
|
+
mailto:unicorn-public@yhbt.net This includes the Debian BTS
|
21
21
|
at https://bugs.debian.org/unicorn and possibly others.
|
22
22
|
|
23
23
|
If your issue is of a sensitive nature or you're just shy in public,
|
@@ -73,10 +73,10 @@ document distributed with git) on guidelines for patch submission.
|
|
73
73
|
|
74
74
|
== Contact Info
|
75
75
|
|
76
|
-
* public: mailto:unicorn-public@
|
77
|
-
* nntp://news.gmane.
|
76
|
+
* public: mailto:unicorn-public@yhbt.net
|
77
|
+
* nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general
|
78
78
|
* nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
|
79
|
-
* https://
|
79
|
+
* https://yhbt.net/unicorn-public/
|
80
80
|
* http://ou63pmih66umazou.onion/unicorn-public/
|
81
81
|
|
82
82
|
Mailing list subscription is optional, so Cc: all participants.
|
@@ -84,13 +84,13 @@ Mailing list subscription is optional, so Cc: all participants.
|
|
84
84
|
You can follow along via NNTP (read-only):
|
85
85
|
|
86
86
|
nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
|
87
|
-
nntp://news.gmane.
|
87
|
+
nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general
|
88
88
|
|
89
89
|
Or Atom feeds:
|
90
90
|
|
91
|
-
https://
|
91
|
+
https://yhbt.net/unicorn-public/new.atom
|
92
92
|
http://ou63pmih66umazou.onion/unicorn-public/new.atom
|
93
93
|
|
94
|
-
The HTML archives at https://
|
94
|
+
The HTML archives at https://yhbt.net/unicorn-public/
|
95
95
|
also has links to per-thread Atom feeds and downloadable
|
96
96
|
mboxes.
|
data/KNOWN_ISSUES
CHANGED
@@ -9,7 +9,7 @@ acceptable solution. Those issues are documented here.
|
|
9
9
|
handlers.
|
10
10
|
|
11
11
|
* Issues with FreeBSD jails can be worked around as documented by Tatsuya Ono:
|
12
|
-
https://
|
12
|
+
https://yhbt.net/unicorn-public/CAHBuKRj09FdxAgzsefJWotexw-7JYZGJMtgUp_dhjPz9VbKD6Q@mail.gmail.com/
|
13
13
|
|
14
14
|
* PRNGs (pseudo-random number generators) loaded before forking
|
15
15
|
(e.g. "preload_app true") may need to have their internal state
|
@@ -60,7 +60,7 @@ acceptable solution. Those issues are documented here.
|
|
60
60
|
application to use Rails 2.3.2 and you have no other choice, then
|
61
61
|
you may edit your unicorn gemspec and remove the Rack dependency.
|
62
62
|
|
63
|
-
ref: https://
|
63
|
+
ref: https://yhbt.net/unicorn-public/20091014221552.GA30624@dcvr.yhbt.net/
|
64
64
|
Note: the workaround described in the article above only made
|
65
65
|
the issue more subtle and we didn't notice them immediately.
|
66
66
|
|
data/Links
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
If you're interested in unicorn, you may be interested in some of the projects
|
4
4
|
listed below. If you have any links to add/change/remove, please tell us at
|
5
|
-
mailto:unicorn-public@
|
5
|
+
mailto:unicorn-public@yhbt.net!
|
6
6
|
|
7
7
|
== Disclaimer
|
8
8
|
|
@@ -23,10 +23,10 @@ or services behind them.
|
|
23
23
|
* {golden_brindle}[https://github.com/simonoff/golden_brindle] - tool to
|
24
24
|
manage multiple unicorn instances/applications on a single server
|
25
25
|
|
26
|
-
* {raindrops}[https://
|
26
|
+
* {raindrops}[https://yhbt.net/raindrops/] - real-time stats for
|
27
27
|
preforking Rack servers
|
28
28
|
|
29
|
-
* {UnXF}[https://
|
29
|
+
* {UnXF}[https://yhbt.net/unxf/] Un-X-Forward* the Rack environment,
|
30
30
|
useful since unicorn is designed to be deployed behind a reverse proxy.
|
31
31
|
|
32
32
|
=== unicorn is written to work with
|
@@ -52,7 +52,7 @@ or services behind them.
|
|
52
52
|
* {Mongrel}[https://rubygems.org/gems/mongrel] - the awesome webserver
|
53
53
|
unicorn is based on. A historical archive of the mongrel dev list
|
54
54
|
featuring early discussions of unicorn is available at:
|
55
|
-
https://
|
55
|
+
https://yhbt.net/mongrel-devel/
|
56
56
|
|
57
|
-
* {david}[https://
|
57
|
+
* {david}[https://yhbt.net/david.git] - a tool to explain why you need
|
58
58
|
nginx in front of unicorn
|
data/README
CHANGED
@@ -80,12 +80,12 @@ You may install it via RubyGems on RubyGems.org:
|
|
80
80
|
You can get the latest source via git from the following locations
|
81
81
|
(these versions may not be stable):
|
82
82
|
|
83
|
-
https://
|
83
|
+
https://yhbt.net/unicorn.git
|
84
84
|
https://repo.or.cz/unicorn.git (mirror)
|
85
85
|
|
86
86
|
You may browse the code from the web:
|
87
87
|
|
88
|
-
* https://
|
88
|
+
* https://yhbt.net/unicorn.git
|
89
89
|
* https://repo.or.cz/w/unicorn.git (gitweb)
|
90
90
|
|
91
91
|
See the HACKING guide on how to contribute and build prerelease gems
|
@@ -133,13 +133,13 @@ and libraries which run on top of it.
|
|
133
133
|
|
134
134
|
All feedback (bug reports, user/development dicussion, patches, pull
|
135
135
|
requests) go to the mailing list/newsgroup. See the ISSUES document for
|
136
|
-
information on the {mailing list}[mailto:unicorn-public@
|
136
|
+
information on the {mailing list}[mailto:unicorn-public@yhbt.net].
|
137
137
|
|
138
|
-
The mailing list is archived at https://
|
138
|
+
The mailing list is archived at https://yhbt.net/unicorn-public/
|
139
139
|
Read-only NNTP access is available at:
|
140
140
|
nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn and
|
141
|
-
nntp://news.gmane.
|
141
|
+
nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general
|
142
142
|
|
143
143
|
For the latest on unicorn releases, you may also finger us at
|
144
|
-
unicorn@
|
144
|
+
unicorn@yhbt.net or check our NEWS page (and subscribe to our Atom
|
145
145
|
feed).
|
data/SIGNALS
CHANGED
@@ -8,7 +8,7 @@ should be possible to easily share process management scripts between
|
|
8
8
|
Unicorn and nginx.
|
9
9
|
|
10
10
|
One example init script is distributed with unicorn:
|
11
|
-
https://
|
11
|
+
https://yhbt.net/unicorn/examples/init.sh
|
12
12
|
|
13
13
|
=== Master Process
|
14
14
|
|
data/Sandbox
CHANGED
@@ -34,7 +34,7 @@ is the primary issue with sandboxing tools such as Bundler and Isolate.
|
|
34
34
|
If you're bundling unicorn, use "bundle exec unicorn" (or "bundle exec
|
35
35
|
unicorn_rails") to start unicorn with the correct environment variables
|
36
36
|
|
37
|
-
ref: https://
|
37
|
+
ref: https://yhbt.net/unicorn-public/9ECF07C4-5216-47BE-961D-AFC0F0C82060@internetfamo.us/
|
38
38
|
|
39
39
|
Otherwise (if you choose to not sandbox your unicorn installation), we
|
40
40
|
expect the tips for Isolate (below) apply, too.
|
@@ -44,7 +44,7 @@ expect the tips for Isolate (below) apply, too.
|
|
44
44
|
This is no longer be an issue as of bundler 0.9.17
|
45
45
|
|
46
46
|
ref:
|
47
|
-
https://
|
47
|
+
https://yhbt.net/unicorn-public/8FC34B23-5994-41CC-B5AF-7198EF06909E@tramchase.com/
|
48
48
|
|
49
49
|
=== BUNDLE_GEMFILE for Capistrano users
|
50
50
|
|
data/archive/slrnpull.conf
CHANGED
data/examples/big_app_gc.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
# see {Unicorn::OobGC}[https://
|
1
|
+
# see {Unicorn::OobGC}[https://yhbt.net/unicorn/Unicorn/OobGC.html]
|
2
2
|
# Unicorn::OobGC was broken in Unicorn v3.3.1 - v3.6.1 and fixed in v3.6.2
|
data/examples/logrotate.conf
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# https://linux.die.net/man/8/logrotate
|
6
6
|
#
|
7
7
|
# public logrotate-related discussion in our archives:
|
8
|
-
# https://
|
8
|
+
# https://yhbt.net/unicorn-public/?q=logrotate
|
9
9
|
|
10
10
|
# Modify the following glob to match the logfiles your app writes to:
|
11
11
|
/var/log/unicorn_app/*.log {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
systemctl kill -s SIGUSR1 unicorn@2.service
|
34
34
|
|
35
35
|
# Examples for other process management systems appreciated
|
36
|
-
# Mail us at unicorn-public@
|
36
|
+
# Mail us at unicorn-public@yhbt.net
|
37
37
|
# (see above for archives)
|
38
38
|
|
39
39
|
# If you use a pid file and assuming your pid file
|
data/examples/nginx.conf
CHANGED
@@ -113,7 +113,7 @@ http {
|
|
113
113
|
# try_files directive appeared in in nginx 0.7.27 and has stabilized
|
114
114
|
# over time. Older versions of nginx (e.g. 0.6.x) requires
|
115
115
|
# "if (!-f $request_filename)" which was less efficient:
|
116
|
-
# https://
|
116
|
+
# https://yhbt.net/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
|
117
117
|
try_files $uri/index.html $uri.html $uri @app;
|
118
118
|
|
119
119
|
location @app {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Minimal sample configuration file for Unicorn (not Rack) when used
|
2
2
|
# with daemonization (unicorn -D) started in your working directory.
|
3
3
|
#
|
4
|
-
# See https://
|
4
|
+
# See https://yhbt.net/unicorn/Unicorn/Configurator.html for complete
|
5
5
|
# documentation.
|
6
|
-
# See also https://
|
6
|
+
# See also https://yhbt.net/unicorn/examples/unicorn.conf.rb for
|
7
7
|
# a more verbose configuration using more features.
|
8
8
|
|
9
9
|
listen 2007 # by default Unicorn listens on port 8080
|
data/examples/unicorn.conf.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
#
|
3
3
|
# This configuration file documents many features of Unicorn
|
4
4
|
# that may not be needed for some applications. See
|
5
|
-
# https://
|
5
|
+
# https://yhbt.net/unicorn/examples/unicorn.conf.minimal.rb
|
6
6
|
# for a much simpler configuration file.
|
7
7
|
#
|
8
|
-
# See https://
|
8
|
+
# See https://yhbt.net/unicorn/Unicorn/Configurator.html for complete
|
9
9
|
# documentation.
|
10
10
|
|
11
11
|
# Use at least one worker per core if you're on a dedicated server,
|
data/examples/unicorn@.service
CHANGED
@@ -14,7 +14,14 @@ After = unicorn.socket
|
|
14
14
|
# bundler users must use the "--keep-file-descriptors" switch, here:
|
15
15
|
# ExecStart = bundle exec --keep-file-descriptors unicorn -c ...
|
16
16
|
ExecStart = /usr/bin/unicorn -c /path/to/unicorn.conf.rb /path/to/config.ru
|
17
|
+
|
18
|
+
# NonBlocking MUST be true if using socket activation with unicorn.
|
19
|
+
# Otherwise, there's a small window in-between when the non-blocking
|
20
|
+
# flag is set by us and our accept4 call where systemd can momentarily
|
21
|
+
# make the socket blocking, causing us to block on accept4:
|
22
|
+
NonBlocking = true
|
17
23
|
Sockets = unicorn.socket
|
24
|
+
|
18
25
|
KillSignal = SIGQUIT
|
19
26
|
User = nobody
|
20
27
|
Group = nogroup
|
@@ -62,7 +62,8 @@ struct http_parser {
|
|
62
62
|
} len;
|
63
63
|
};
|
64
64
|
|
65
|
-
static ID id_set_backtrace;
|
65
|
+
static ID id_set_backtrace, id_is_chunked_p;
|
66
|
+
static VALUE cHttpParser;
|
66
67
|
|
67
68
|
#ifdef HAVE_RB_HASH_CLEAR /* Ruby >= 2.0 */
|
68
69
|
# define my_hash_clear(h) (void)rb_hash_clear(h)
|
@@ -220,6 +221,19 @@ static void write_cont_value(struct http_parser *hp,
|
|
220
221
|
rb_str_buf_cat(hp->cont, vptr, end + 1);
|
221
222
|
}
|
222
223
|
|
224
|
+
static int is_chunked(VALUE v)
|
225
|
+
{
|
226
|
+
/* common case first */
|
227
|
+
if (STR_CSTR_CASE_EQ(v, "chunked"))
|
228
|
+
return 1;
|
229
|
+
|
230
|
+
/*
|
231
|
+
* call Ruby function in unicorn/http_request.rb to deal with unlikely
|
232
|
+
* comma-delimited case
|
233
|
+
*/
|
234
|
+
return rb_funcall(cHttpParser, id_is_chunked_p, 1, v) != Qfalse;
|
235
|
+
}
|
236
|
+
|
223
237
|
static void write_value(struct http_parser *hp,
|
224
238
|
const char *buffer, const char *p)
|
225
239
|
{
|
@@ -246,7 +260,9 @@ static void write_value(struct http_parser *hp,
|
|
246
260
|
f = uncommon_field(field, flen);
|
247
261
|
} else if (f == g_http_connection) {
|
248
262
|
hp_keepalive_connection(hp, v);
|
249
|
-
} else if (f == g_content_length) {
|
263
|
+
} else if (f == g_content_length && !HP_FL_TEST(hp, CHUNKED)) {
|
264
|
+
if (hp->len.content)
|
265
|
+
parser_raise(eHttpParserError, "Content-Length already set");
|
250
266
|
hp->len.content = parse_length(RSTRING_PTR(v), RSTRING_LEN(v));
|
251
267
|
if (hp->len.content < 0)
|
252
268
|
parser_raise(eHttpParserError, "invalid Content-Length");
|
@@ -254,9 +270,30 @@ static void write_value(struct http_parser *hp,
|
|
254
270
|
HP_FL_SET(hp, HASBODY);
|
255
271
|
hp_invalid_if_trailer(hp);
|
256
272
|
} else if (f == g_http_transfer_encoding) {
|
257
|
-
if (
|
273
|
+
if (is_chunked(v)) {
|
274
|
+
if (HP_FL_TEST(hp, CHUNKED))
|
275
|
+
/*
|
276
|
+
* RFC 7230 3.3.1:
|
277
|
+
* A sender MUST NOT apply chunked more than once to a message body
|
278
|
+
* (i.e., chunking an already chunked message is not allowed).
|
279
|
+
*/
|
280
|
+
parser_raise(eHttpParserError, "Transfer-Encoding double chunked");
|
281
|
+
|
258
282
|
HP_FL_SET(hp, CHUNKED);
|
259
283
|
HP_FL_SET(hp, HASBODY);
|
284
|
+
|
285
|
+
/* RFC 7230 3.3.3, 3: favor chunked if Content-Length exists */
|
286
|
+
hp->len.content = 0;
|
287
|
+
} else if (HP_FL_TEST(hp, CHUNKED)) {
|
288
|
+
/*
|
289
|
+
* RFC 7230 3.3.3, point 3 states:
|
290
|
+
* If a Transfer-Encoding header field is present in a request and
|
291
|
+
* the chunked transfer coding is not the final encoding, the
|
292
|
+
* message body length cannot be determined reliably; the server
|
293
|
+
* MUST respond with the 400 (Bad Request) status code and then
|
294
|
+
* close the connection.
|
295
|
+
*/
|
296
|
+
parser_raise(eHttpParserError, "invalid Transfer-Encoding");
|
260
297
|
}
|
261
298
|
hp_invalid_if_trailer(hp);
|
262
299
|
} else if (f == g_http_trailer) {
|
@@ -487,7 +524,7 @@ static void set_url_scheme(VALUE env, VALUE *server_port)
|
|
487
524
|
* and X-Forwarded-Proto handling from this parser? We've had it
|
488
525
|
* forever and nobody has said anything against it, either.
|
489
526
|
* Anyways, please send comments to our public mailing list:
|
490
|
-
* unicorn-public@
|
527
|
+
* unicorn-public@yhbt.net (no HTML mail, no subscription necessary)
|
491
528
|
*/
|
492
529
|
scheme = rb_hash_aref(env, g_http_x_forwarded_ssl);
|
493
530
|
if (!NIL_P(scheme) && STR_CSTR_EQ(scheme, "on")) {
|
@@ -931,7 +968,7 @@ static VALUE HttpParser_rssget(VALUE self)
|
|
931
968
|
|
932
969
|
void Init_unicorn_http(void)
|
933
970
|
{
|
934
|
-
VALUE mUnicorn
|
971
|
+
VALUE mUnicorn;
|
935
972
|
|
936
973
|
mUnicorn = rb_define_module("Unicorn");
|
937
974
|
cHttpParser = rb_define_class_under(mUnicorn, "HttpParser", rb_cObject);
|
@@ -991,5 +1028,6 @@ void Init_unicorn_http(void)
|
|
991
1028
|
#ifndef HAVE_RB_HASH_CLEAR
|
992
1029
|
id_clear = rb_intern("clear");
|
993
1030
|
#endif
|
1031
|
+
id_is_chunked_p = rb_intern("is_chunked?");
|
994
1032
|
}
|
995
1033
|
#undef SET_GLOBAL
|
data/lib/unicorn.rb
CHANGED
@@ -96,7 +96,7 @@ def self.builder(ru, op)
|
|
96
96
|
|
97
97
|
# returns an array of strings representing TCP listen socket addresses
|
98
98
|
# and Unix domain socket paths. This is useful for use with
|
99
|
-
# Raindrops::Middleware under Linux: https://
|
99
|
+
# Raindrops::Middleware under Linux: https://yhbt.net/raindrops/
|
100
100
|
def self.listener_names
|
101
101
|
Unicorn::HttpServer::LISTENERS.map do |io|
|
102
102
|
Unicorn::SocketHelper.sock_name(io)
|
data/lib/unicorn/configurator.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
|
4
4
|
# Implements a simple DSL for configuring a unicorn server.
|
5
5
|
#
|
6
|
-
# See https://
|
7
|
-
# https://
|
6
|
+
# See https://yhbt.net/unicorn/examples/unicorn.conf.rb and
|
7
|
+
# https://yhbt.net/unicorn/examples/unicorn.conf.minimal.rb
|
8
8
|
# example configuration files. An example config file for use with
|
9
9
|
# nginx is also available at
|
10
|
-
# https://
|
10
|
+
# https://yhbt.net/unicorn/examples/nginx.conf
|
11
11
|
#
|
12
12
|
# See the link:/TUNING.html document for more information on tuning unicorn.
|
13
13
|
class Unicorn::Configurator
|
@@ -53,6 +53,7 @@ class Unicorn::Configurator
|
|
53
53
|
server.logger.info("worker=#{worker.nr} ready")
|
54
54
|
},
|
55
55
|
:pid => nil,
|
56
|
+
:early_hints => false,
|
56
57
|
:worker_exec => false,
|
57
58
|
:preload_app => false,
|
58
59
|
:check_client_connection => false,
|
@@ -276,6 +277,15 @@ def default_middleware(bool)
|
|
276
277
|
set_bool(:default_middleware, bool)
|
277
278
|
end
|
278
279
|
|
280
|
+
# sets whether to enable the proposed early hints Rack API.
|
281
|
+
# If enabled, Rails 5.2+ will automatically send a 103 Early Hint
|
282
|
+
# for all the `javascript_include_tag` and `stylesheet_link_tag`
|
283
|
+
# in your response. See: https://api.rubyonrails.org/v5.2/classes/ActionDispatch/Request.html#method-i-send_early_hints
|
284
|
+
# See also https://tools.ietf.org/html/rfc8297
|
285
|
+
def early_hints(bool)
|
286
|
+
set_bool(:early_hints, bool)
|
287
|
+
end
|
288
|
+
|
279
289
|
# sets listeners to the given +addresses+, replacing or augmenting the
|
280
290
|
# current set. This is for the global listener pool shared by all
|
281
291
|
# worker processes. For per-worker listeners, see the after_fork example
|