unicorn 5.5.1 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.manifest +5 -5
  3. data/.olddoc.yml +12 -7
  4. data/Documentation/.gitignore +1 -3
  5. data/Documentation/unicorn.1 +222 -0
  6. data/Documentation/unicorn_rails.1 +207 -0
  7. data/FAQ +1 -1
  8. data/GIT-VERSION-FILE +1 -1
  9. data/GIT-VERSION-GEN +1 -1
  10. data/GNUmakefile +111 -56
  11. data/HACKING +1 -1
  12. data/ISSUES +16 -13
  13. data/KNOWN_ISSUES +2 -2
  14. data/Links +5 -5
  15. data/README +13 -6
  16. data/SIGNALS +1 -1
  17. data/Sandbox +2 -2
  18. data/archive/slrnpull.conf +1 -1
  19. data/examples/big_app_gc.rb +1 -1
  20. data/examples/logrotate.conf +2 -2
  21. data/examples/nginx.conf +1 -1
  22. data/examples/unicorn.conf.minimal.rb +2 -2
  23. data/examples/unicorn.conf.rb +2 -2
  24. data/examples/unicorn@.service +7 -0
  25. data/ext/unicorn_http/extconf.rb +5 -0
  26. data/ext/unicorn_http/unicorn_http.c +253 -215
  27. data/ext/unicorn_http/unicorn_http.rl +43 -5
  28. data/lib/unicorn/configurator.rb +13 -3
  29. data/lib/unicorn/http_request.rb +11 -1
  30. data/lib/unicorn/http_server.rb +37 -5
  31. data/lib/unicorn/oob_gc.rb +5 -5
  32. data/lib/unicorn/tmpio.rb +8 -2
  33. data/lib/unicorn/version.rb +1 -1
  34. data/lib/unicorn.rb +1 -1
  35. data/man/man1/unicorn.1 +89 -88
  36. data/man/man1/unicorn_rails.1 +77 -79
  37. data/t/GNUmakefile +3 -72
  38. data/test/benchmark/README +14 -4
  39. data/test/benchmark/ddstream.ru +50 -0
  40. data/test/benchmark/readinput.ru +40 -0
  41. data/test/benchmark/uconnect.perl +66 -0
  42. data/test/exec/test_exec.rb +14 -12
  43. data/test/test_helper.rb +38 -30
  44. data/test/unit/test_ccc.rb +4 -3
  45. data/test/unit/test_http_parser_ng.rb +81 -0
  46. data/test/unit/test_server.rb +81 -7
  47. data/test/unit/test_signals.rb +6 -6
  48. data/test/unit/test_socket_helper.rb +1 -1
  49. data/test/unit/test_upload.rb +9 -14
  50. data/test/unit/test_util.rb +1 -1
  51. data/unicorn.gemspec +8 -7
  52. metadata +12 -11
  53. data/Documentation/GNUmakefile +0 -30
  54. data/Documentation/unicorn.1.txt +0 -187
  55. data/Documentation/unicorn_rails.1.txt +0 -173
  56. data/t/hijack.ru +0 -55
  57. data/t/t0200-rack-hijack.sh +0 -51
@@ -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 (STR_CSTR_CASE_EQ(v, "chunked")) {
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@bogomips.org (no HTML mail, no subscription necessary)
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, cHttpParser;
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
@@ -3,11 +3,11 @@ require 'logger'
3
3
 
4
4
  # Implements a simple DSL for configuring a unicorn server.
5
5
  #
6
- # See https://bogomips.org/unicorn/examples/unicorn.conf.rb and
7
- # https://bogomips.org/unicorn/examples/unicorn.conf.minimal.rb
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://bogomips.org/unicorn/examples/nginx.conf
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 @@ class Unicorn::Configurator
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
@@ -62,7 +62,6 @@ class Unicorn::HttpParser
62
62
  # This does minimal exception trapping and it is up to the caller
63
63
  # to handle any socket errors (e.g. user aborted upload).
64
64
  def read(socket)
65
- clear
66
65
  e = env
67
66
 
68
67
  # From https://www.ietf.org/rfc/rfc3875:
@@ -188,4 +187,15 @@ class Unicorn::HttpParser
188
187
  HTTP_RESPONSE_START.each { |c| socket.write(c) }
189
188
  end
190
189
  end
190
+
191
+ # called by ext/unicorn_http/unicorn_http.rl via rb_funcall
192
+ def self.is_chunked?(v) # :nodoc:
193
+ vals = v.split(/[ \t]*,[ \t]*/).map!(&:downcase)
194
+ if vals.pop == 'chunked'.freeze
195
+ return true unless vals.include?('chunked'.freeze)
196
+ raise Unicorn::HttpParserError, 'double chunked', []
197
+ end
198
+ return false unless vals.include?('chunked'.freeze)
199
+ raise Unicorn::HttpParserError, 'chunked not last', []
200
+ end
191
201
  end
@@ -6,7 +6,7 @@
6
6
  # forked worker children.
7
7
  #
8
8
  # Users do not need to know the internals of this class, but reading the
9
- # {source}[https://bogomips.org/unicorn.git/tree/lib/unicorn/http_server.rb]
9
+ # {source}[https://yhbt.net/unicorn.git/tree/lib/unicorn/http_server.rb]
10
10
  # is education for programmers wishing to learn how unicorn works.
11
11
  # See Unicorn::Configurator for information on how to configure unicorn.
12
12
  class Unicorn::HttpServer
@@ -15,7 +15,7 @@ class Unicorn::HttpServer
15
15
  :before_fork, :after_fork, :before_exec,
16
16
  :listener_opts, :preload_app,
17
17
  :orig_app, :config, :ready_pipe, :user,
18
- :default_middleware
18
+ :default_middleware, :early_hints
19
19
  attr_writer :after_worker_exit, :after_worker_ready, :worker_exec
20
20
 
21
21
  attr_reader :pid, :logger
@@ -69,7 +69,6 @@ class Unicorn::HttpServer
69
69
  # incoming requests on the socket.
70
70
  def initialize(app, options = {})
71
71
  @app = app
72
- @request = Unicorn::HttpRequest.new
73
72
  @reexec_pid = 0
74
73
  @default_middleware = true
75
74
  options = options.dup
@@ -588,6 +587,25 @@ class Unicorn::HttpServer
588
587
  rescue
589
588
  end
590
589
 
590
+ def e103_response_write(client, headers)
591
+ response = if @request.response_start_sent
592
+ "103 Early Hints\r\n"
593
+ else
594
+ "HTTP/1.1 103 Early Hints\r\n"
595
+ end
596
+
597
+ headers.each_pair do |k, vs|
598
+ next if !vs || vs.empty?
599
+ values = vs.to_s.split("\n".freeze)
600
+ values.each do |v|
601
+ response << "#{k}: #{v}\r\n"
602
+ end
603
+ end
604
+ response << "\r\n".freeze
605
+ response << "HTTP/1.1 ".freeze if @request.response_start_sent
606
+ client.write(response)
607
+ end
608
+
591
609
  def e100_response_write(client, env)
592
610
  # We use String#freeze to avoid allocations under Ruby 2.1+
593
611
  # Not many users hit this code path, so it's better to reduce the
@@ -602,7 +620,18 @@ class Unicorn::HttpServer
602
620
  # once a client is accepted, it is processed in its entirety here
603
621
  # in 3 easy steps: read request, call app, write app response
604
622
  def process_client(client)
605
- status, headers, body = @app.call(env = @request.read(client))
623
+ @request = Unicorn::HttpRequest.new
624
+ env = @request.read(client)
625
+
626
+ if early_hints
627
+ env["rack.early_hints"] = lambda do |headers|
628
+ e103_response_write(client, headers)
629
+ end
630
+ end
631
+
632
+ env["rack.after_reply"] = []
633
+
634
+ status, headers, body = @app.call(env)
606
635
 
607
636
  begin
608
637
  return if @request.hijacked?
@@ -624,6 +653,8 @@ class Unicorn::HttpServer
624
653
  end
625
654
  rescue => e
626
655
  handle_error(client, e)
656
+ ensure
657
+ env["rack.after_reply"].each(&:call) if env
627
658
  end
628
659
 
629
660
  def nuke_listeners!(readers)
@@ -686,6 +717,7 @@ class Unicorn::HttpServer
686
717
  trap(:USR1) { nr = -65536 }
687
718
 
688
719
  ready = readers.dup
720
+ nr_listeners = readers.size
689
721
  @after_worker_ready.call(self, worker)
690
722
 
691
723
  begin
@@ -708,7 +740,7 @@ class Unicorn::HttpServer
708
740
  # we're probably reasonably busy, so avoid calling select()
709
741
  # and do a speculative non-blocking accept() on ready listeners
710
742
  # before we sleep again in select().
711
- unless nr == 0
743
+ if nr == nr_listeners
712
744
  tmp = ready.dup
713
745
  redo
714
746
  end
@@ -43,8 +43,8 @@
43
43
  # use Unicorn::OobGC, 2, %r{\A/(?:expensive/foo|more_expensive/foo)}
44
44
  #
45
45
  # Feedback from users of early implementations of this module:
46
- # * https://bogomips.org/unicorn-public/0BFC98E9-072B-47EE-9A70-05478C20141B@lukemelia.com/
47
- # * https://bogomips.org/unicorn-public/AANLkTilUbgdyDv9W1bi-s_W6kq9sOhWfmuYkKLoKGOLj@mail.gmail.com/
46
+ # * https://yhbt.net/unicorn-public/0BFC98E9-072B-47EE-9A70-05478C20141B@lukemelia.com/
47
+ # * https://yhbt.net/unicorn-public/AANLkTilUbgdyDv9W1bi-s_W6kq9sOhWfmuYkKLoKGOLj@mail.gmail.com/
48
48
 
49
49
  module Unicorn::OobGC
50
50
 
@@ -60,7 +60,6 @@ module Unicorn::OobGC
60
60
  self.const_set :OOBGC_INTERVAL, interval
61
61
  ObjectSpace.each_object(Unicorn::HttpServer) do |s|
62
62
  s.extend(self)
63
- self.const_set :OOBGC_ENV, s.instance_variable_get(:@request).env
64
63
  end
65
64
  app # pretend to be Rack middleware since it was in the past
66
65
  end
@@ -68,9 +67,10 @@ module Unicorn::OobGC
68
67
  #:stopdoc:
69
68
  def process_client(client)
70
69
  super(client) # Unicorn::HttpServer#process_client
71
- if OOBGC_PATH =~ OOBGC_ENV['PATH_INFO'] && ((@@nr -= 1) <= 0)
70
+ env = instance_variable_get(:@request).env
71
+ if OOBGC_PATH =~ env['PATH_INFO'] && ((@@nr -= 1) <= 0)
72
72
  @@nr = OOBGC_INTERVAL
73
- OOBGC_ENV.clear
73
+ env.clear
74
74
  disabled = GC.enable
75
75
  GC.start
76
76
  GC.disable if disabled
data/lib/unicorn/tmpio.rb CHANGED
@@ -11,12 +11,18 @@ class Unicorn::TmpIO < File
11
11
  # immediately, switched to binary mode, and userspace output
12
12
  # buffering is disabled
13
13
  def self.new
14
+ path = nil
15
+
16
+ # workaround File#path being tainted:
17
+ # https://bugs.ruby-lang.org/issues/14485
14
18
  fp = begin
15
- super("#{Dir::tmpdir}/#{rand}", RDWR|CREAT|EXCL, 0600)
19
+ path = "#{Dir::tmpdir}/#{rand}"
20
+ super(path, RDWR|CREAT|EXCL, 0600)
16
21
  rescue Errno::EEXIST
17
22
  retry
18
23
  end
19
- unlink(fp.path)
24
+
25
+ unlink(path)
20
26
  fp.binmode
21
27
  fp.sync = true
22
28
  fp
@@ -1 +1 @@
1
- Unicorn::Const::UNICORN_VERSION = '5.5.1'
1
+ Unicorn::Const::UNICORN_VERSION = '6.0.0'
data/lib/unicorn.rb CHANGED
@@ -96,7 +96,7 @@ module Unicorn
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://bogomips.org/raindrops/
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/man/man1/unicorn.1 CHANGED
@@ -1,5 +1,3 @@
1
- .\" Automatically generated by Pandoc 1.17.2
2
- .\"
3
1
  .TH "UNICORN" "1" "September 15, 2009" "Unicorn User Manual" ""
4
2
  .hy
5
3
  .SH NAME
@@ -11,73 +9,73 @@ unicorn [\-c CONFIG_FILE] [\-E RACK_ENV] [\-D] [RACKUP_FILE]
11
9
  .SH DESCRIPTION
12
10
  .PP
13
11
  A rackup(1)\-like command to launch Rack applications using Unicorn.
14
- It is expected to be started in your application root (APP_ROOT), but
15
- the "working_directory" directive may be used in the CONFIG_FILE.
12
+ It is expected to be started in your application root (APP_ROOT),
13
+ but the "working_directory" directive may be used in the CONFIG_FILE.
16
14
  .PP
17
- While unicorn takes a myriad of command\-line options for compatibility
18
- with ruby(1) and rackup(1), it is recommended to stick to the few
19
- command\-line options specified in the SYNOPSIS and use the CONFIG_FILE
20
- as much as possible.
15
+ While unicorn takes a myriad of command\-line options for
16
+ compatibility with ruby(1) and rackup(1), it is recommended to stick
17
+ to the few command\-line options specified in the SYNOPSIS and use
18
+ the CONFIG_FILE as much as possible.
21
19
  .SH RACKUP FILE
22
20
  .PP
23
- This defaults to "config.ru" in APP_ROOT.
24
- It should be the same file used by rackup(1) and other Rack launchers,
25
- it uses the \f[I]Rack::Builder\f[] DSL.
21
+ This defaults to "config.ru" in APP_ROOT. It should be the same
22
+ file used by rackup(1) and other Rack launchers, it uses the
23
+ \f[I]Rack::Builder\f[] DSL.
26
24
  .PP
27
- Embedded command\-line options are mostly parsed for compatibility with
28
- rackup(1) but strongly discouraged.
25
+ Embedded command\-line options are mostly parsed for compatibility
26
+ with rackup(1) but strongly discouraged.
29
27
  .SH UNICORN OPTIONS
30
28
  .TP
31
29
  .B \-c, \-\-config\-file CONFIG_FILE
32
- Path to the Unicorn\-specific config file.
33
- The config file is implemented as a Ruby DSL, so Ruby code may executed.
34
- See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for the
35
- full list of directives available from the DSL.
36
- Using an absolute path for for CONFIG_FILE is recommended as it makes
37
- multiple instances of Unicorn easily distinguishable when viewing ps(1)
38
- output.
30
+ Path to the Unicorn\-specific config file. The config file is
31
+ implemented as a Ruby DSL, so Ruby code may executed.
32
+ See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for the full
33
+ list of directives available from the DSL.
34
+ Using an absolute path for for CONFIG_FILE is recommended as it
35
+ makes multiple instances of Unicorn easily distinguishable when
36
+ viewing ps(1) output.
39
37
  .RS
40
38
  .RE
41
39
  .TP
42
40
  .B \-D, \-\-daemonize
43
- Run daemonized in the background.
44
- The process is detached from the controlling terminal and stdin is
45
- redirected to "/dev/null".
46
- Unlike many common UNIX daemons, we do not chdir to "/" upon
47
- daemonization to allow more control over the startup/upgrade process.
48
- Unless specified in the CONFIG_FILE, stderr and stdout will also be
49
- redirected to "/dev/null".
41
+ Run daemonized in the background. The process is detached from
42
+ the controlling terminal and stdin is redirected to "/dev/null".
43
+ Unlike many common UNIX daemons, we do not chdir to "/"
44
+ upon daemonization to allow more control over the startup/upgrade
45
+ process.
46
+ Unless specified in the CONFIG_FILE, stderr and stdout will
47
+ also be redirected to "/dev/null".
50
48
  .RS
51
49
  .RE
52
50
  .TP
53
51
  .B \-E, \-\-env RACK_ENV
54
- Run under the given RACK_ENV.
55
- See the RACK ENVIRONMENT section for more details.
52
+ Run under the given RACK_ENV. See the RACK ENVIRONMENT section
53
+ for more details.
56
54
  .RS
57
55
  .RE
58
56
  .TP
59
57
  .B \-l, \-\-listen ADDRESS
60
- Listens on a given ADDRESS.
61
- ADDRESS may be in the form of HOST:PORT or PATH, HOST:PORT is taken to
62
- mean a TCP socket and PATH is meant to be a path to a UNIX domain
63
- socket.
64
- Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080) For
65
- production deployments, specifying the "listen" directive in CONFIG_FILE
66
- is recommended as it allows fine\-tuning of socket options.
67
- \-N, \-\-no\-default\-middleware
58
+ Listens on a given ADDRESS. ADDRESS may be in the form of
59
+ HOST:PORT or PATH, HOST:PORT is taken to mean a TCP socket
60
+ and PATH is meant to be a path to a UNIX domain socket.
61
+ Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080)
62
+ For production deployments, specifying the "listen" directive in
63
+ CONFIG_FILE is recommended as it allows fine\-tuning of socket
64
+ options.
68
65
  .RS
69
66
  .RE
70
- Disables loading middleware implied by RACK_ENV.
71
- This bypasses the configuration documented in the RACK ENVIRONMENT
72
- section, but still allows RACK_ENV to be used for
73
- application/framework\-specific purposes.
67
+ .TP
68
+ .B \-N, \-\-no\-default\-middleware
69
+ Disables loading middleware implied by RACK_ENV. This bypasses the
70
+ configuration documented in the RACK ENVIRONMENT section, but still
71
+ allows RACK_ENV to be used for application/framework\-specific purposes.
74
72
  .RS
75
73
  .RE
76
74
  .SH RACKUP COMPATIBILITY OPTIONS
77
75
  .TP
78
76
  .B \-o, \-\-host HOST
79
- Listen on a TCP socket belonging to HOST, default is "0.0.0.0" (all
80
- addresses).
77
+ Listen on a TCP socket belonging to HOST, default is
78
+ "0.0.0.0" (all addresses).
81
79
  If specified multiple times on the command\-line, only the
82
80
  last\-specified value takes effect.
83
81
  This option only exists for compatibility with the rackup(1) command,
@@ -87,8 +85,8 @@ use of "\-l"/"\-\-listen" switch is recommended instead.
87
85
  .TP
88
86
  .B \-p, \-\-port PORT
89
87
  Listen on the specified TCP PORT, default is 8080.
90
- If specified multiple times on the command\-line, only the
91
- last\-specified value takes effect.
88
+ If specified multiple times on the command\-line, only the last\-specified
89
+ value takes effect.
92
90
  This option only exists for compatibility with the rackup(1) command,
93
91
  use of "\-l"/"\-\-listen" switch is recommended instead.
94
92
  .RS
@@ -101,9 +99,8 @@ No\-op, this exists only for compatibility with rackup(1).
101
99
  .SH RUBY OPTIONS
102
100
  .TP
103
101
  .B \-e, \-\-eval LINE
104
- Evaluate a LINE of Ruby code.
105
- This evaluation happens immediately as the command\-line is being
106
- parsed.
102
+ Evaluate a LINE of Ruby code. This evaluation happens
103
+ immediately as the command\-line is being parsed.
107
104
  .RS
108
105
  .RE
109
106
  .TP
@@ -118,18 +115,17 @@ Turn on verbose warnings, the $VERBOSE variable is set to true.
118
115
  .RE
119
116
  .TP
120
117
  .B \-I, \-\-include PATH
121
- specify $LOAD_PATH.
122
- PATH will be prepended to $LOAD_PATH.
118
+ specify $LOAD_PATH. PATH will be prepended to $LOAD_PATH.
123
119
  The \[aq]:\[aq] character may be used to delimit multiple directories.
124
- This directive may be used more than once.
125
- Modifications to $LOAD_PATH take place immediately and in the order they
126
- were specified on the command\-line.
120
+ This directive may be used more than once. Modifications to
121
+ $LOAD_PATH take place immediately and in the order they were
122
+ specified on the command\-line.
127
123
  .RS
128
124
  .RE
129
125
  .TP
130
126
  .B \-r, \-\-require LIBRARY
131
- require a specified LIBRARY before executing the application.
132
- The "require" statement will be executed immediately and in the order
127
+ require a specified LIBRARY before executing the application. The
128
+ "require" statement will be executed immediately and in the order
133
129
  they were specified on the command\-line.
134
130
  .RS
135
131
  .RE
@@ -141,15 +137,15 @@ HUP \- reload config file, app, and gracefully restart all workers
141
137
  .IP \[bu] 2
142
138
  INT/TERM \- quick shutdown, kills all workers immediately
143
139
  .IP \[bu] 2
144
- QUIT \- graceful shutdown, waits for workers to finish their current
145
- request before finishing.
140
+ QUIT \- graceful shutdown, waits for workers to finish their
141
+ current request before finishing.
146
142
  .IP \[bu] 2
147
- USR1 \- reopen all logs owned by the master and all workers See
148
- Unicorn::Util.reopen_logs for what is considered a log.
143
+ USR1 \- reopen all logs owned by the master and all workers
144
+ See Unicorn::Util.reopen_logs for what is considered a log.
149
145
  .IP \[bu] 2
150
- USR2 \- reexecute the running binary.
151
- A separate QUIT should be sent to the original process once the child is
152
- verified to be up and running.
146
+ USR2 \- reexecute the running binary. A separate QUIT
147
+ should be sent to the original process once the child is verified to
148
+ be up and running.
153
149
  .IP \[bu] 2
154
150
  WINCH \- gracefully stops workers but keep the master running.
155
151
  This will only work for daemonized processes.
@@ -158,7 +154,7 @@ TTIN \- increment the number of worker processes by one
158
154
  .IP \[bu] 2
159
155
  TTOU \- decrement the number of worker processes by one
160
156
  .PP
161
- See the SIGNALS (https://bogomips.org/unicorn/SIGNALS.html) document for
157
+ See the SIGNALS (https://yhbt.net/unicorn/SIGNALS.html) document for
162
158
  full description of all signals used by Unicorn.
163
159
  .SH RACK ENVIRONMENT
164
160
  .PP
@@ -166,56 +162,61 @@ Accepted values of RACK_ENV and the middleware they automatically load
166
162
  (outside of RACKUP_FILE) are exactly as those in rackup(1):
167
163
  .IP \[bu] 2
168
164
  development \- loads Rack::CommonLogger, Rack::ShowExceptions, and
169
- Rack::Lint middleware
165
+ Rack::Lint middleware
170
166
  .IP \[bu] 2
171
167
  deployment \- loads Rack::CommonLogger middleware
172
168
  .IP \[bu] 2
173
169
  none \- loads no middleware at all, relying entirely on RACKUP_FILE
174
170
  .PP
175
- All unrecognized values for RACK_ENV are assumed to be "none".
176
- Production deployments are strongly encouraged to use "deployment" or
177
- "none" for maximum performance.
171
+ All unrecognized values for RACK_ENV are assumed to be
172
+ "none". Production deployments are strongly encouraged to use
173
+ "deployment" or "none" for maximum performance.
178
174
  .PP
179
- As of Unicorn 0.94.0, RACK_ENV is exported as a process\-wide
180
- environment variable as well.
181
- While not current a part of the Rack specification as of Rack 1.0.1,
182
- this has become a de facto standard in the Rack world.
175
+ As of Unicorn 0.94.0, RACK_ENV is exported as a process\-wide environment
176
+ variable as well. While not current a part of the Rack specification as
177
+ of Rack 1.0.1, this has become a de facto standard in the Rack world.
183
178
  .PP
184
179
  Note the Rack::ContentLength and Rack::Chunked middlewares are also
185
180
  loaded by "deployment" and "development", but no other values of
186
- RACK_ENV.
187
- If needed, they must be individually specified in the RACKUP_FILE, some
188
- frameworks do not require them.
181
+ RACK_ENV. If needed, they must be individually specified in the
182
+ RACKUP_FILE, some frameworks do not require them.
189
183
  .SH ENVIRONMENT VARIABLES
190
184
  .PP
191
185
  The RACK_ENV variable is set by the aforementioned \-E switch.
192
- All application or library\-specific environment variables (e.g.
193
- TMPDIR) may always be set in the Unicorn CONFIG_FILE in addition to the
194
- spawning shell.
195
- When transparently upgrading Unicorn, all environment variables set in
196
- the old master process are inherited by the new master process.
186
+ All application or library\-specific environment variables (e.g. TMPDIR)
187
+ may always be set in the Unicorn CONFIG_FILE in addition to the spawning
188
+ shell. When transparently upgrading Unicorn, all environment variables
189
+ set in the old master process are inherited by the new master process.
197
190
  Unicorn only uses (and will overwrite) the UNICORN_FD environment
198
191
  variable internally when doing transparent upgrades.
199
192
  .PP
200
193
  UNICORN_FD is a comma\-delimited list of one or more file descriptors
201
- used to implement USR2 upgrades.
202
- Init systems may bind listen sockets itself and spawn unicorn with
203
- UNICORN_FD set to the file descriptor numbers of the listen socket(s).
194
+ used to implement USR2 upgrades. Init systems may bind listen sockets
195
+ itself and spawn unicorn with UNICORN_FD set to the file descriptor
196
+ numbers of the listen socket(s).
204
197
  .PP
205
198
  As of unicorn 5.0, LISTEN_PID and LISTEN_FDS are used for socket
206
- activation as documented in the sd_listen_fds(3) manpage.
207
- Users relying on this feature do not need to specify a listen socket in
199
+ activation as documented in the sd_listen_fds(3) manpage. Users
200
+ relying on this feature do not need to specify a listen socket in
208
201
  the unicorn config file.
209
202
  .SH SEE ALSO
210
203
  .IP \[bu] 2
211
204
  \f[I]Rack::Builder\f[] ri/RDoc
212
205
  .IP \[bu] 2
213
206
  \f[I]Unicorn::Configurator\f[] ri/RDoc
207
+ .UR https://yhbt.net/unicorn/Unicorn/Configurator.html
208
+ .UE
214
209
  .IP \[bu] 2
215
- Unicorn RDoc (https://bogomips.org/unicorn/)
210
+ unicorn RDoc
211
+ .UR https://yhbt.net/unicorn/
212
+ .UE
216
213
  .IP \[bu] 2
217
- Rack RDoc (https://www.rubydoc.info/github/rack/rack/)
214
+ Rack RDoc
215
+ .UR https://www.rubydoc.info/github/rack/rack/
216
+ .UE
218
217
  .IP \[bu] 2
219
- Rackup HowTo (https://github.com/rack/rack/wiki/tutorial-rackup-howto)
218
+ Rackup HowTo
219
+ .UR https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
220
+ .UE
220
221
  .SH AUTHORS
221
- The Unicorn Community <unicorn-public@bogomips.org>.
222
+ The Unicorn Community <unicorn-public@yhbt.net>.