unicorn 5.4.0 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.manifest +2 -0
  3. data/.olddoc.yml +1 -1
  4. data/Application_Timeouts +4 -4
  5. data/Documentation/unicorn.1.txt +1 -1
  6. data/Documentation/unicorn_rails.1.txt +1 -1
  7. data/GIT-VERSION-FILE +1 -1
  8. data/GIT-VERSION-GEN +1 -1
  9. data/ISSUES +5 -2
  10. data/LATEST +25 -8
  11. data/LICENSE +2 -2
  12. data/Links +9 -7
  13. data/NEWS +71 -0
  14. data/README +13 -6
  15. data/Sandbox +2 -2
  16. data/bin/unicorn +3 -1
  17. data/examples/logrotate.conf +1 -1
  18. data/examples/nginx.conf +3 -2
  19. data/ext/unicorn_http/common_field_optimization.h +24 -6
  20. data/ext/unicorn_http/extconf.rb +30 -0
  21. data/ext/unicorn_http/global_variables.h +2 -2
  22. data/ext/unicorn_http/httpdate.c +2 -2
  23. data/ext/unicorn_http/unicorn_http.c +4 -9
  24. data/ext/unicorn_http/unicorn_http.rl +4 -9
  25. data/lib/unicorn.rb +19 -8
  26. data/lib/unicorn/configurator.rb +12 -1
  27. data/lib/unicorn/http_request.rb +1 -2
  28. data/lib/unicorn/http_server.rb +19 -20
  29. data/lib/unicorn/launcher.rb +1 -1
  30. data/lib/unicorn/socket_helper.rb +3 -2
  31. data/lib/unicorn/util.rb +3 -3
  32. data/lib/unicorn/version.rb +1 -1
  33. data/lib/unicorn/worker.rb +16 -2
  34. data/man/man1/unicorn.1 +7 -5
  35. data/man/man1/unicorn_rails.1 +6 -3
  36. data/t/README +4 -4
  37. data/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
  38. data/t/t0301.ru +13 -0
  39. data/test/exec/test_exec.rb +6 -7
  40. data/test/unit/test_ccc.rb +1 -1
  41. data/test/unit/test_http_parser.rb +16 -0
  42. data/test/unit/test_server.rb +5 -5
  43. data/test/unit/test_signals.rb +2 -2
  44. data/test/unit/test_socket_helper.rb +4 -4
  45. data/test/unit/test_util.rb +25 -0
  46. data/unicorn.gemspec +1 -1
  47. metadata +5 -4
data/man/man1/unicorn.1 CHANGED
@@ -1,4 +1,7 @@
1
+ .\" Automatically generated by Pandoc 1.17.2
2
+ .\"
1
3
  .TH "UNICORN" "1" "September 15, 2009" "Unicorn User Manual" ""
4
+ .hy
2
5
  .SH NAME
3
6
  .PP
4
7
  unicorn \- a rackup\-like command to launch the Unicorn HTTP server
@@ -61,10 +64,9 @@ socket.
61
64
  Defaults to "0.0.0.0:8080" (all addresses on TCP port 8080) For
62
65
  production deployments, specifying the "listen" directive in CONFIG_FILE
63
66
  is recommended as it allows fine\-tuning of socket options.
67
+ \-N, \-\-no\-default\-middleware
64
68
  .RS
65
69
  .RE
66
- .TP
67
- .B \-N, \-\-no\-default\-middleware
68
70
  Disables loading middleware implied by RACK_ENV.
69
71
  This bypasses the configuration documented in the RACK ENVIRONMENT
70
72
  section, but still allows RACK_ENV to be used for
@@ -116,8 +118,8 @@ Turn on verbose warnings, the $VERBOSE variable is set to true.
116
118
  .RE
117
119
  .TP
118
120
  .B \-I, \-\-include PATH
119
- specify
120
- \f[I]L\f[]\f[I]O\f[]\f[I]A\f[]\f[I]D\f[]~\f[I]P\f[]~\f[I]A\f[]\f[I]T\f[]\f[I]H\f[].\f[I]P\f[]\f[I]A\f[]\f[I]T\f[]\f[I]H\f[]\f[I]w\f[]\f[I]i\f[]\f[I]l\f[]\f[I]l\f[]\f[I]b\f[]\f[I]e\f[]\f[I]p\f[]\f[I]r\f[]\f[I]e\f[]\f[I]p\f[]\f[I]e\f[]\f[I]n\f[]\f[I]d\f[]\f[I]e\f[]\f[I]d\f[]\f[I]t\f[]\f[I]o\f[]LOAD_PATH.
121
+ specify $LOAD_PATH.
122
+ PATH will be prepended to $LOAD_PATH.
121
123
  The \[aq]:\[aq] character may be used to delimit multiple directories.
122
124
  This directive may be used more than once.
123
125
  Modifications to $LOAD_PATH take place immediately and in the order they
@@ -212,7 +214,7 @@ the unicorn config file.
212
214
  .IP \[bu] 2
213
215
  Unicorn RDoc (https://bogomips.org/unicorn/)
214
216
  .IP \[bu] 2
215
- Rack RDoc (http://www.rubydoc.info/github/rack/rack/)
217
+ Rack RDoc (https://www.rubydoc.info/github/rack/rack/)
216
218
  .IP \[bu] 2
217
219
  Rackup HowTo (https://github.com/rack/rack/wiki/tutorial-rackup-howto)
218
220
  .SH AUTHORS
@@ -1,4 +1,7 @@
1
+ .\" Automatically generated by Pandoc 1.17.2
2
+ .\"
1
3
  .TH "UNICORN_RAILS" "1" "September 17, 2009" "Unicorn User Manual" ""
4
+ .hy
2
5
  .SH NAME
3
6
  .PP
4
7
  unicorn_rails \- unicorn launcher for Rails 1.x and 2.x users
@@ -125,8 +128,8 @@ Turn on verbose warnings, the $VERBOSE variable is set to true.
125
128
  .RE
126
129
  .TP
127
130
  .B \-I, \-\-include PATH
128
- specify
129
- \f[I]L\f[]\f[I]O\f[]\f[I]A\f[]\f[I]D\f[]~\f[I]P\f[]~\f[I]A\f[]\f[I]T\f[]\f[I]H\f[].\f[I]P\f[]\f[I]A\f[]\f[I]T\f[]\f[I]H\f[]\f[I]w\f[]\f[I]i\f[]\f[I]l\f[]\f[I]l\f[]\f[I]b\f[]\f[I]e\f[]\f[I]p\f[]\f[I]r\f[]\f[I]e\f[]\f[I]p\f[]\f[I]e\f[]\f[I]n\f[]\f[I]d\f[]\f[I]e\f[]\f[I]d\f[]\f[I]t\f[]\f[I]o\f[]LOAD_PATH.
131
+ specify $LOAD_PATH.
132
+ PATH will be prepended to $LOAD_PATH.
130
133
  The \[aq]:\[aq] character may be used to delimit multiple directories.
131
134
  This directive may be used more than once.
132
135
  Modifications to $LOAD_PATH take place immediately and in the order they
@@ -202,7 +205,7 @@ unicorn(1)
202
205
  .IP \[bu] 2
203
206
  Unicorn RDoc (https://bogomips.org/unicorn/)
204
207
  .IP \[bu] 2
205
- Rack RDoc (http://www.rubydoc.info/github/rack/rack/)
208
+ Rack RDoc (https://www.rubydoc.info/github/rack/rack/)
206
209
  .IP \[bu] 2
207
210
  Rackup HowTo (https://github.com/rack/rack/wiki/tutorial-rackup-howto)
208
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}[http://www.gnu.org/software/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}[http://curl.haxx.se/]
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}[http://www.gnu.org/software/bash/], too.
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)
@@ -193,8 +193,8 @@ def test_working_directory_rel_path_config_file
193
193
  assert_equal other.path, results.first
194
194
 
195
195
  Process.kill(:QUIT, pid)
196
- ensure
197
- FileUtils.rmtree(other.path)
196
+ ensure
197
+ FileUtils.rmtree(other.path)
198
198
  end
199
199
 
200
200
  def test_working_directory
@@ -229,8 +229,8 @@ def test_working_directory
229
229
  assert_equal other.path, results.first
230
230
 
231
231
  Process.kill(:QUIT, pid)
232
- ensure
233
- FileUtils.rmtree(other.path)
232
+ ensure
233
+ FileUtils.rmtree(other.path)
234
234
  end
235
235
 
236
236
  def test_working_directory_controls_relative_paths
@@ -271,11 +271,10 @@ def test_working_directory_controls_relative_paths
271
271
  wait_master_ready("#{other.path}/stderr_log_here")
272
272
 
273
273
  Process.kill(:QUIT, pid)
274
- ensure
275
- FileUtils.rmtree(other.path)
274
+ ensure
275
+ FileUtils.rmtree(other.path)
276
276
  end
277
277
 
278
-
279
278
  def test_exit_signals
280
279
  %w(INT TERM QUIT).each do |sig|
281
280
  File.open("config.ru", "wb") { |fp| fp.syswrite(HI) }
@@ -44,7 +44,7 @@ def test_ccc_tcpi
44
44
  # make sure the server is running, at least
45
45
  client = TCPSocket.new(host, port)
46
46
  client.write("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
47
- assert client.wait_readable(10), 'never got response from server'
47
+ assert client.wait(10), 'never got response from server'
48
48
  res = client.read
49
49
  assert_match %r{\AHTTP/1\.1 200}, res, 'got part of first response'
50
50
  assert_match %r{\r\n\r\n\z}, res, 'got end of response, server is ready'
@@ -865,4 +865,20 @@ def test_memsize
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
@@ -17,9 +17,9 @@ def call(env)
17
17
  while env['rack.input'].read(4096)
18
18
  end
19
19
  [200, { 'Content-Type' => 'text/plain' }, ['hello!\n']]
20
- rescue Unicorn::ClientShutdown, Unicorn::HttpParserError => e
21
- $stderr.syswrite("#{e.class}: #{e.message} #{e.backtrace.empty?}\n")
22
- raise e
20
+ rescue Unicorn::ClientShutdown, Unicorn::HttpParserError => e
21
+ $stderr.syswrite("#{e.class}: #{e.message} #{e.backtrace.empty?}\n")
22
+ raise e
23
23
  end
24
24
  end
25
25
 
@@ -80,8 +80,8 @@ def test_preload_app_config
80
80
  loader_pid = tmp.sysread(4096).to_i
81
81
  assert_equal $$, loader_pid
82
82
  assert worker_pid != loader_pid
83
- ensure
84
- tmp.close!
83
+ ensure
84
+ tmp.close!
85
85
  end
86
86
 
87
87
  def test_broken_app
@@ -114,8 +114,8 @@ def test_timeout_slow_response
114
114
  assert_nil buf
115
115
  assert diff > 1.0, "diff was #{diff.inspect}"
116
116
  assert diff < 60.0
117
- ensure
118
- Process.kill(:TERM, pid) rescue nil
117
+ ensure
118
+ Process.kill(:TERM, pid) rescue nil
119
119
  end
120
120
 
121
121
  def test_response_write
@@ -57,8 +57,8 @@ def test_bind_listen_unix
57
57
  assert File.readable?(@unix_listener_path), "not readable"
58
58
  assert File.writable?(@unix_listener_path), "not writable"
59
59
  assert_equal 0777, File.umask
60
- ensure
61
- File.umask(old_umask)
60
+ ensure
61
+ File.umask(old_umask)
62
62
  end
63
63
 
64
64
  def test_bind_listen_unix_umask
@@ -71,8 +71,8 @@ def test_bind_listen_unix_umask
71
71
  assert_equal @unix_listener_path, sock_name(@unix_listener)
72
72
  assert_equal 0140700, File.stat(@unix_listener_path).mode
73
73
  assert_equal 0777, File.umask
74
- ensure
75
- File.umask(old_umask)
74
+ ensure
75
+ File.umask(old_umask)
76
76
  end
77
77
 
78
78
  def test_bind_listen_unix_idempotent
@@ -102,4 +102,29 @@ def test_reopen_logs_renamed_with_internal_encoding
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 @@
11
11
 
12
12
  Gem::Specification.new do |s|
13
13
  s.name = %q{unicorn}
14
- s.version = (ENV['VERSION'] || '5.4.0').dup
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.0
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: 2017-12-23 00:00:00.000000000 Z
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
- rubyforge_project:
291
- rubygems_version: 2.7.3
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