unicorn 5.8.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3166eb1eac760d39cac35a6fc46332d6a6a2ee75bdf594118fddb3c6a959f6d
4
- data.tar.gz: 3e18599fef201efdd79c67eb126aab35787c196054313a727d6bb184f830587e
3
+ metadata.gz: f3857fb0079316977174fc2e513749fd8b76297e719caf6e172097099eb57752
4
+ data.tar.gz: 68edc58cd61e17a3f409b56d963ed2f8b458f9d457772c7cfa9df933b76af6a4
5
5
  SHA512:
6
- metadata.gz: 356f0c951cee2e69de8e49169f2c9560e6fead9fe759bd0af5a51097888a23794eb17175ff5393f07d1fadec5678215b494b688cdeeadb8a95c37201f3808a92
7
- data.tar.gz: ffa1f8781231ac559157310d2d235340522c6c1cccf69be3d87d432659d2a2a7a39d744a84306c1f4292a3f6b36141cc1bb80497f1a9047902ec0d592f77871b
6
+ metadata.gz: 01cae9ce7852f28d4484ffbf458ca9a40b3b19b4531c2b633287751fabc5547076eddd7e773ab2bad6b2812e95b4a717a6ae598fa183061844948f0cd417dcfc
7
+ data.tar.gz: 850460b0d5caa60e23b2a386a5d2dcaf8321722c81dcb9aa65d55c46a0b81978fd305eda915478e566efa29dd8e605bc73ca3a3ae214af6e91083b64df5468e1
data/GIT-VERSION-GEN CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- DEF_VER = "v5.8.0"
2
+ DEF_VER = "v6.0.0"
3
3
  CONSTANT = "Unicorn::Const::UNICORN_VERSION"
4
4
  RVF = "lib/unicorn/version.rb"
5
5
  GVF = "GIT-VERSION-FILE"
@@ -62,7 +62,6 @@ def self.check_client_connection=(bool)
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:
@@ -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
@@ -621,6 +620,7 @@ def e100_response_write(client, env)
621
620
  # once a client is accepted, it is processed in its entirety here
622
621
  # in 3 easy steps: read request, call app, write app response
623
622
  def process_client(client)
623
+ @request = Unicorn::HttpRequest.new
624
624
  env = @request.read(client)
625
625
 
626
626
  if early_hints
@@ -60,7 +60,6 @@ def self.new(app, interval = 5, path = %r{\A/})
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 @@ def self.new(app, interval = 5, path = %r{\A/})
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
@@ -574,7 +574,7 @@ def test_unicorn_config_per_worker_listen
574
574
  assert_equal String, results[0].class
575
575
  worker_pid = results[0].to_i
576
576
  assert_not_equal pid, worker_pid
577
- s = UNIXSocket.new(tmp.path)
577
+ s = unix_socket(tmp.path)
578
578
  s.syswrite("GET / HTTP/1.0\r\n\r\n")
579
579
  results = ''
580
580
  loop { results << s.sysread(4096) } rescue nil
@@ -732,7 +732,7 @@ def test_socket_unlinked_restore
732
732
  wait_for_file(sock_path)
733
733
  assert File.socket?(sock_path)
734
734
 
735
- sock = UNIXSocket.new(sock_path)
735
+ sock = unix_socket(sock_path)
736
736
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
737
737
  results = sock.sysread(4096)
738
738
 
@@ -742,7 +742,7 @@ def test_socket_unlinked_restore
742
742
  wait_for_file(sock_path)
743
743
  assert File.socket?(sock_path)
744
744
 
745
- sock = UNIXSocket.new(sock_path)
745
+ sock = unix_socket(sock_path)
746
746
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
747
747
  results = sock.sysread(4096)
748
748
 
@@ -777,7 +777,7 @@ def test_unicorn_config_file
777
777
  assert_equal pid, File.read(pid_file).to_i
778
778
  assert File.socket?(sock_path), "socket created"
779
779
 
780
- sock = UNIXSocket.new(sock_path)
780
+ sock = unix_socket(sock_path)
781
781
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
782
782
  results = sock.sysread(4096)
783
783
 
@@ -803,7 +803,7 @@ def test_unicorn_config_file
803
803
  wait_for_file(new_sock_path)
804
804
  assert File.socket?(new_sock_path), "socket exists"
805
805
  @sockets.each do |path|
806
- sock = UNIXSocket.new(path)
806
+ sock = unix_socket(path)
807
807
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
808
808
  results = sock.sysread(4096)
809
809
  assert_equal String, results.class
data/test/test_helper.rb CHANGED
@@ -28,6 +28,7 @@
28
28
  require 'fileutils'
29
29
  require 'logger'
30
30
  require 'unicorn'
31
+ require 'io/nonblock'
31
32
 
32
33
  if ENV['DEBUG']
33
34
  require 'ruby-debug'
@@ -42,6 +43,7 @@
42
43
  def redirect_test_io
43
44
  orig_err = STDERR.dup
44
45
  orig_out = STDOUT.dup
46
+ rdr_pid = $$
45
47
  new_out = File.open("test_stdout.#$$.log", "a")
46
48
  new_err = File.open("test_stderr.#$$.log", "a")
47
49
  new_out.sync = new_err.sync = true
@@ -59,8 +61,10 @@ def redirect_test_io
59
61
  STDERR.sync = STDOUT.sync = true
60
62
 
61
63
  at_exit do
62
- File.unlink(new_out.path) rescue nil
63
- File.unlink(new_err.path) rescue nil
64
+ if rdr_pid == $$
65
+ File.unlink(new_out.path) rescue nil
66
+ File.unlink(new_err.path) rescue nil
67
+ end
64
68
  end
65
69
 
66
70
  begin
@@ -288,3 +292,15 @@ def reset_sig_handlers
288
292
  trap(sig, "DEFAULT")
289
293
  end
290
294
  end
295
+
296
+ def tcp_socket(*args)
297
+ sock = TCPSocket.new(*args)
298
+ sock.nonblock = false
299
+ sock
300
+ end
301
+
302
+ def unix_socket(*args)
303
+ sock = UNIXSocket.new(*args)
304
+ sock.nonblock = false
305
+ sock
306
+ end
@@ -3,6 +3,7 @@
3
3
  require 'io/wait'
4
4
  require 'tempfile'
5
5
  require 'test/unit'
6
+ require './test/test_helper'
6
7
 
7
8
  class TestCccTCPI < Test::Unit::TestCase
8
9
  def test_ccc_tcpi
@@ -42,7 +43,7 @@ def test_ccc_tcpi
42
43
  wr.close
43
44
 
44
45
  # make sure the server is running, at least
45
- client = TCPSocket.new(host, port)
46
+ client = tcp_socket(host, port)
46
47
  client.write("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
47
48
  assert client.wait(10), 'never got response from server'
48
49
  res = client.read
@@ -51,13 +52,13 @@ def test_ccc_tcpi
51
52
  client.close
52
53
 
53
54
  # start a slow request...
54
- sleeper = TCPSocket.new(host, port)
55
+ sleeper = tcp_socket(host, port)
55
56
  sleeper.write("GET /sleep HTTP/1.1\r\nHost: example.com\r\n\r\n")
56
57
 
57
58
  # and a bunch of aborted ones
58
59
  nr = 100
59
60
  nr.times do |i|
60
- client = TCPSocket.new(host, port)
61
+ client = tcp_socket(host, port)
61
62
  client.write("GET /collections/#{rand(10000)} HTTP/1.1\r\n" \
62
63
  "Host: example.com\r\n\r\n")
63
64
  client.close
@@ -121,7 +121,7 @@ def test_early_hints
121
121
  @server.start
122
122
  end
123
123
 
124
- sock = TCPSocket.new('127.0.0.1', @port)
124
+ sock = tcp_socket('127.0.0.1', @port)
125
125
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
126
126
 
127
127
  responses = sock.read(4096)
@@ -141,14 +141,14 @@ def test_after_reply
141
141
  @server.start
142
142
  end
143
143
 
144
- sock = TCPSocket.new('127.0.0.1', @port)
144
+ sock = tcp_socket('127.0.0.1', @port)
145
145
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
146
146
 
147
147
  responses = sock.read(4096)
148
148
  assert_match %r{\AHTTP/1.[01] 200\b}, responses
149
149
  assert_match %r{^after_reply_called: false}, responses
150
150
 
151
- sock = TCPSocket.new('127.0.0.1', @port)
151
+ sock = tcp_socket('127.0.0.1', @port)
152
152
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
153
153
 
154
154
  responses = sock.read(4096)
@@ -166,7 +166,7 @@ def test_broken_app
166
166
  @server = HttpServer.new(app, :listeners => [ "127.0.0.1:#@port"] )
167
167
  @server.start
168
168
  end
169
- sock = TCPSocket.new('127.0.0.1', @port)
169
+ sock = tcp_socket('127.0.0.1', @port)
170
170
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
171
171
  assert_match %r{\AHTTP/1.[01] 500\b}, sock.sysread(4096)
172
172
  assert_nil sock.close
@@ -179,7 +179,7 @@ def test_simple_server
179
179
 
180
180
  def test_client_shutdown_writes
181
181
  bs = 15609315 * rand
182
- sock = TCPSocket.new('127.0.0.1', @port)
182
+ sock = tcp_socket('127.0.0.1', @port)
183
183
  sock.syswrite("PUT /hello HTTP/1.1\r\n")
184
184
  sock.syswrite("Host: example.com\r\n")
185
185
  sock.syswrite("Transfer-Encoding: chunked\r\n")
@@ -206,7 +206,7 @@ def test_client_shutdown_writes
206
206
 
207
207
  def test_client_shutdown_write_truncates
208
208
  bs = 15609315 * rand
209
- sock = TCPSocket.new('127.0.0.1', @port)
209
+ sock = tcp_socket('127.0.0.1', @port)
210
210
  sock.syswrite("PUT /hello HTTP/1.1\r\n")
211
211
  sock.syswrite("Host: example.com\r\n")
212
212
  sock.syswrite("Transfer-Encoding: chunked\r\n")
@@ -232,7 +232,7 @@ def test_client_shutdown_write_truncates
232
232
 
233
233
  def test_client_malformed_body
234
234
  bs = 15653984
235
- sock = TCPSocket.new('127.0.0.1', @port)
235
+ sock = tcp_socket('127.0.0.1', @port)
236
236
  sock.syswrite("PUT /hello HTTP/1.1\r\n")
237
237
  sock.syswrite("Host: example.com\r\n")
238
238
  sock.syswrite("Transfer-Encoding: chunked\r\n")
@@ -254,7 +254,7 @@ def test_client_malformed_body
254
254
 
255
255
  def do_test(string, chunk, close_after=nil, shutdown_delay=0)
256
256
  # Do not use instance variables here, because it needs to be thread safe
257
- socket = TCPSocket.new("127.0.0.1", @port);
257
+ socket = tcp_socket("127.0.0.1", @port);
258
258
  request = StringIO.new(string)
259
259
  chunks_out = 0
260
260
 
@@ -299,14 +299,14 @@ def test_logger_changed
299
299
  end
300
300
 
301
301
  def test_bad_client_400
302
- sock = TCPSocket.new('127.0.0.1', @port)
302
+ sock = tcp_socket('127.0.0.1', @port)
303
303
  sock.syswrite("GET / HTTP/1.0\r\nHost: foo\rbar\r\n\r\n")
304
304
  assert_match %r{\AHTTP/1.[01] 400\b}, sock.sysread(4096)
305
305
  assert_nil sock.close
306
306
  end
307
307
 
308
308
  def test_http_0_9
309
- sock = TCPSocket.new('127.0.0.1', @port)
309
+ sock = tcp_socket('127.0.0.1', @port)
310
310
  sock.syswrite("GET /hello\r\n")
311
311
  assert_match 'hello!\n', sock.sysread(4096)
312
312
  assert_nil sock.close
@@ -52,7 +52,7 @@ def test_worker_dies_on_dead_master
52
52
  redirect_test_io { HttpServer.new(app, opts).start.join }
53
53
  }
54
54
  wait_workers_ready("test_stderr.#{pid}.log", 1)
55
- sock = TCPSocket.new('127.0.0.1', @port)
55
+ sock = tcp_socket('127.0.0.1', @port)
56
56
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
57
57
  buf = sock.readpartial(4096)
58
58
  assert_nil sock.close
@@ -79,7 +79,7 @@ def test_sleepy_kill
79
79
  }
80
80
  wr.close
81
81
  wait_workers_ready("test_stderr.#{pid}.log", 1)
82
- sock = TCPSocket.new('127.0.0.1', @port)
82
+ sock = tcp_socket('127.0.0.1', @port)
83
83
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
84
84
  buf = rd.readpartial(1)
85
85
  wait_master_ready("test_stderr.#{pid}.log")
@@ -102,7 +102,7 @@ def test_timeout_slow_response
102
102
  }
103
103
  t0 = Time.now
104
104
  wait_workers_ready("test_stderr.#{pid}.log", 1)
105
- sock = TCPSocket.new('127.0.0.1', @port)
105
+ sock = tcp_socket('127.0.0.1', @port)
106
106
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
107
107
 
108
108
  buf = nil
@@ -125,7 +125,7 @@ def test_response_write
125
125
  }
126
126
  redirect_test_io { @server = HttpServer.new(app, @server_opts).start }
127
127
  wait_workers_ready("test_stderr.#{$$}.log", 1)
128
- sock = TCPSocket.new('127.0.0.1', @port)
128
+ sock = tcp_socket('127.0.0.1', @port)
129
129
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
130
130
  buf = ''
131
131
  header_len = pid = nil
@@ -163,13 +163,13 @@ def test_request_read
163
163
  redirect_test_io { @server = HttpServer.new(app, @server_opts).start }
164
164
 
165
165
  wait_workers_ready("test_stderr.#{$$}.log", 1)
166
- sock = TCPSocket.new('127.0.0.1', @port)
166
+ sock = tcp_socket('127.0.0.1', @port)
167
167
  sock.syswrite("GET / HTTP/1.0\r\n\r\n")
168
168
  pid = sock.sysread(4096)[/\r\nX-Pid: (\d+)\r\n/, 1].to_i
169
169
  assert_nil sock.close
170
170
 
171
171
  assert pid > 0, "pid not positive: #{pid.inspect}"
172
- sock = TCPSocket.new('127.0.0.1', @port)
172
+ sock = tcp_socket('127.0.0.1', @port)
173
173
  sock.syswrite("PUT / HTTP/1.0\r\n")
174
174
  sock.syswrite("Content-Length: #{@bs * @count}\r\n\r\n")
175
175
  1000.times { Process.kill(:HUP, pid) }
@@ -116,7 +116,7 @@ def test_bind_listen_unix_rebind
116
116
  client.syswrite('abcde')
117
117
  exit 0
118
118
  end
119
- s = UNIXSocket.new(@unix_listener_path)
119
+ s = unix_socket(@unix_listener_path)
120
120
  IO.select([s])
121
121
  assert_equal 'abcde', s.sysread(5)
122
122
  pid, status = Process.waitpid2(pid)
@@ -60,7 +60,7 @@ def teardown
60
60
 
61
61
  def test_put
62
62
  start_server(@sha1_app)
63
- sock = TCPSocket.new(@addr, @port)
63
+ sock = tcp_socket(@addr, @port)
64
64
  sock.syswrite("PUT / HTTP/1.0\r\nContent-Length: #{length}\r\n\r\n")
65
65
  @count.times do |i|
66
66
  buf = @random.sysread(@bs)
@@ -77,7 +77,7 @@ def test_put
77
77
  def test_put_content_md5
78
78
  md5 = Digest::MD5.new
79
79
  start_server(@sha1_app)
80
- sock = TCPSocket.new(@addr, @port)
80
+ sock = tcp_socket(@addr, @port)
81
81
  sock.syswrite("PUT / HTTP/1.0\r\nTransfer-Encoding: chunked\r\n" \
82
82
  "Trailer: Content-MD5\r\n\r\n")
83
83
  @count.times do |i|
@@ -103,7 +103,7 @@ def test_put_trickle_small
103
103
  @count, @bs = 2, 128
104
104
  start_server(@sha1_app)
105
105
  assert_equal 256, length
106
- sock = TCPSocket.new(@addr, @port)
106
+ sock = tcp_socket(@addr, @port)
107
107
  hdr = "PUT / HTTP/1.0\r\nContent-Length: #{length}\r\n\r\n"
108
108
  @count.times do
109
109
  buf = @random.sysread(@bs)
@@ -122,7 +122,7 @@ def test_put_trickle_small
122
122
 
123
123
  def test_put_keepalive_truncates_small_overwrite
124
124
  start_server(@sha1_app)
125
- sock = TCPSocket.new(@addr, @port)
125
+ sock = tcp_socket(@addr, @port)
126
126
  to_upload = length + 1
127
127
  sock.syswrite("PUT / HTTP/1.0\r\nContent-Length: #{to_upload}\r\n\r\n")
128
128
  @count.times do
@@ -155,7 +155,7 @@ def test_put_excessive_overwrite_closed
155
155
  tmp.write(nr.to_s)
156
156
  [ 200, @hdr, [] ]
157
157
  })
158
- sock = TCPSocket.new(@addr, @port)
158
+ sock = tcp_socket(@addr, @port)
159
159
  buf = ' ' * @bs
160
160
  sock.syswrite("PUT / HTTP/1.0\r\nContent-Length: #{length}\r\n\r\n")
161
161
 
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.8.0').dup
14
+ s.version = (ENV['VERSION'] || '6.0.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.8.0
4
+ version: 6.0.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: 2020-12-24 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -197,7 +197,6 @@ files:
197
197
  - t/env.ru
198
198
  - t/fails-rack-lint.ru
199
199
  - t/heartbeat-timeout.ru
200
- - t/hijack.ru
201
200
  - t/listener_names.ru
202
201
  - t/my-tap-lib.sh
203
202
  - t/oob_gc.ru
@@ -235,7 +234,6 @@ files:
235
234
  - t/t0100-rack-input-tests.sh
236
235
  - t/t0116-client_body_buffer_size.sh
237
236
  - t/t0116.ru
238
- - t/t0200-rack-hijack.sh
239
237
  - t/t0300-no-default-middleware.sh
240
238
  - t/t0301-no-default-middleware-ignored-in-config.sh
241
239
  - t/t0301.ru
data/t/hijack.ru DELETED
@@ -1,55 +0,0 @@
1
- use Rack::Lint
2
- use Rack::ContentLength
3
- use Rack::ContentType, "text/plain"
4
- class DieIfUsed
5
- @@n = 0
6
- def each
7
- abort "body.each called after response hijack\n"
8
- end
9
-
10
- def close
11
- warn "closed DieIfUsed #{@@n += 1}\n"
12
- end
13
- end
14
-
15
- envs = []
16
-
17
- run lambda { |env|
18
- case env["PATH_INFO"]
19
- when "/hijack_req"
20
- if env["rack.hijack?"]
21
- io = env["rack.hijack"].call
22
- envs << env
23
- if io.respond_to?(:read_nonblock) &&
24
- env["rack.hijack_io"].respond_to?(:read_nonblock)
25
-
26
- # exercise both, since we Rack::Lint may use different objects
27
- env["rack.hijack_io"].write("HTTP/1.0 200 OK\r\n\r\n")
28
- io.write("request.hijacked")
29
- io.close
30
- return [ 500, {}, DieIfUsed.new ]
31
- end
32
- end
33
- [ 500, {}, [ "hijack BAD\n" ] ]
34
- when "/hijack_res"
35
- r = "response.hijacked"
36
- [ 200,
37
- {
38
- "Content-Length" => r.bytesize.to_s,
39
- "rack.hijack" => proc do |io|
40
- envs << env
41
- io.write(r)
42
- io.close
43
- end
44
- },
45
- DieIfUsed.new
46
- ]
47
- when "/normal_env_id"
48
- b = "#{env.object_id}\n"
49
- h = {
50
- 'Content-Type' => 'text/plain',
51
- 'Content-Length' => b.bytesize.to_s,
52
- }
53
- [ 200, h, [ b ] ]
54
- end
55
- }
@@ -1,51 +0,0 @@
1
- #!/bin/sh
2
- . ./test-lib.sh
3
- t_plan 9 "rack.hijack tests (Rack 1.5+ (Rack::VERSION >= [ 1,2]))"
4
-
5
- t_begin "setup and start" && {
6
- unicorn_setup
7
- unicorn -D -c $unicorn_config hijack.ru
8
- unicorn_wait_start
9
- }
10
-
11
- t_begin "normal env reused between requests" && {
12
- env_a="$(curl -sSf http://$listen/normal_env_id)"
13
- b="$(curl -sSf http://$listen/normal_env_id)"
14
- test x"$env_a" = x"$b"
15
- }
16
-
17
- t_begin "check request hijack" && {
18
- test "xrequest.hijacked" = x"$(curl -sSfv http://$listen/hijack_req)"
19
- }
20
-
21
- t_begin "env changed after request hijack" && {
22
- env_b="$(curl -sSf http://$listen/normal_env_id)"
23
- test x"$env_a" != x"$env_b"
24
- }
25
-
26
- t_begin "check response hijack" && {
27
- test "xresponse.hijacked" = x"$(curl -sSfv http://$listen/hijack_res)"
28
- }
29
-
30
- t_begin "env changed after response hijack" && {
31
- env_c="$(curl -sSf http://$listen/normal_env_id)"
32
- test x"$env_b" != x"$env_c"
33
- }
34
-
35
- t_begin "env continues to be reused between requests" && {
36
- b="$(curl -sSf http://$listen/normal_env_id)"
37
- test x"$env_c" = x"$b"
38
- }
39
-
40
- t_begin "killing succeeds after hijack" && {
41
- kill $unicorn_pid
42
- }
43
-
44
- t_begin "check stderr for hijacked body close" && {
45
- check_stderr
46
- grep 'closed DieIfUsed 1\>' $r_err
47
- grep 'closed DieIfUsed 2\>' $r_err
48
- ! grep 'closed DieIfUsed 3\>' $r_err
49
- }
50
-
51
- t_done