unicorn 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v3.4.0.GIT
4
+ DEF_VER=v3.5.0.GIT
5
5
 
6
6
  LF='
7
7
  '
@@ -8,6 +8,10 @@ acceptable solution. Those issues are documented here.
8
8
 
9
9
  See http://redmine.ruby-lang.org/issues/show/4338
10
10
 
11
+ * On Ruby 1.8 prior to Ruby 1.8.7-p248, *BSD platforms have a broken
12
+ stdio that causes failure for file uploads larger than 112K. Upgrade
13
+ your version of Ruby or continue using Unicorn 1.x/3.4.x.
14
+
11
15
  * For notes on sandboxing tools such as Bundler or Isolate,
12
16
  see the {Sandbox}[link:Sandbox.html] page.
13
17
 
data/README CHANGED
@@ -60,11 +60,11 @@ both the the request and response in between \Unicorn and slow clients.
60
60
  == License
61
61
 
62
62
  \Unicorn is copyright 2009 by all contributors (see logs in git).
63
- It is based on Mongrel and carries the same license.
63
+ It is based on Mongrel 1.1.5 and carries the same license.
64
64
 
65
65
  Mongrel is copyright 2007 Zed A. Shaw and contributors. It is licensed
66
- under the Ruby license and the GPL2. See the included LICENSE file for
67
- details.
66
+ under the Ruby (1.8) license and the GPL2. See the included LICENSE file
67
+ for details.
68
68
 
69
69
  \Unicorn is 100% Free Software.
70
70
 
@@ -33,7 +33,7 @@ module Unicorn::App
33
33
  sysseek(@body_offset = n)
34
34
  end
35
35
 
36
- def each(&block)
36
+ def each
37
37
  sysseek @body_offset
38
38
  # don't use a preallocated buffer for sysread since we can't
39
39
  # guarantee an actual socket is consuming the yielded string
@@ -47,7 +47,7 @@ module Unicorn::App
47
47
  }
48
48
  end
49
49
 
50
- def each(&block)
50
+ def each
51
51
  begin
52
52
  rd, = IO.select([err_rd, out_rd])
53
53
  rd && rd.first or next
@@ -582,7 +582,7 @@ class Unicorn::HttpServer
582
582
 
583
583
  # closing anything we IO.select on will raise EBADF
584
584
  trap(:USR1) { nr = -65536; SELF_PIPE[0].close rescue nil }
585
- trap(:QUIT) { alive = nil; LISTENERS.each { |s| s.close rescue nil } }
585
+ trap(:QUIT) { alive = nil; LISTENERS.each { |s| s.close rescue nil }.clear }
586
586
  [:TERM, :INT].each { |sig| trap(sig) { exit!(0) } } # instant shutdown
587
587
  logger.info "worker=#{worker.nr} ready"
588
588
  m = 0
@@ -38,8 +38,8 @@ module Unicorn
38
38
  [ status, headers, self ]
39
39
  end
40
40
 
41
- def each(&block)
42
- body.each(&block)
41
+ def each
42
+ body.each { |x| yield x }
43
43
  end
44
44
 
45
45
  # in Unicorn, this is closed _after_ the client socket
@@ -93,7 +93,7 @@ class Unicorn::StreamInput
93
93
  #
94
94
  # Executes the block for every ``line'' in *ios*, where lines are
95
95
  # separated by the global record separator ($/, typically "\n").
96
- def each(&block)
96
+ def each
97
97
  while line = gets
98
98
  yield line
99
99
  end
@@ -120,7 +120,6 @@ private
120
120
  def tee(buffer)
121
121
  if buffer && buffer.size > 0
122
122
  @tmp.write(buffer)
123
- @tmp.seek(0, IO::SEEK_END) # workaround FreeBSD/OSX + MRI 1.8.x bug
124
123
  end
125
124
  buffer
126
125
  end
@@ -17,7 +17,7 @@ opts = {
17
17
  pid = fork do
18
18
  Isolate.now!(opts) do
19
19
  gem 'sqlite3-ruby', '1.2.5'
20
- gem 'kgio', '2.2.0'
20
+ gem 'kgio', '2.3.2'
21
21
  gem 'rack', '1.1.0'
22
22
  end
23
23
  end
@@ -7,11 +7,24 @@ require 'tmpdir'
7
7
 
8
8
  default_port = 8080
9
9
  addr = ENV['UNICORN_TEST_ADDR'] || '127.0.0.1'
10
+ retries = 100
11
+ base = 5000
10
12
  port = sock = lock_path = nil
11
13
 
12
14
  begin
13
- sock = TCPServer.new(addr, 0)
14
- port = sock.addr[1]
15
+ begin
16
+ port = base + rand(32768 - base)
17
+ while port == default_port
18
+ port = base + rand(32768 - base)
19
+ end
20
+
21
+ sock = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
22
+ sock.bind(Socket.pack_sockaddr_in(port, addr))
23
+ sock.listen(5)
24
+ rescue Errno::EADDRINUSE, Errno::EACCES
25
+ sock.close rescue nil
26
+ retry if (retries -= 1) >= 0
27
+ end
15
28
 
16
29
  # since we'll end up closing the random port we just got, there's a race
17
30
  # condition could allow the random port we just chose to reselect itself
@@ -100,17 +100,30 @@ end
100
100
  # for a race condition is very small). You may also set UNICORN_TEST_ADDR
101
101
  # to override the default test address (127.0.0.1).
102
102
  def unused_port(addr = '127.0.0.1')
103
+ retries = 100
104
+ base = 5000
103
105
  port = sock = nil
104
106
  begin
105
- sock = TCPServer.new(addr, 0)
106
- port = sock.addr[1]
107
+ begin
108
+ port = base + rand(32768 - base)
109
+ while port == Unicorn::Const::DEFAULT_PORT
110
+ port = base + rand(32768 - base)
111
+ end
112
+
113
+ sock = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
114
+ sock.bind(Socket.pack_sockaddr_in(port, addr))
115
+ sock.listen(5)
116
+ rescue Errno::EADDRINUSE, Errno::EACCES
117
+ sock.close rescue nil
118
+ retry if (retries -= 1) >= 0
119
+ end
107
120
 
108
121
  # since we'll end up closing the random port we just got, there's a race
109
122
  # condition could allow the random port we just chose to reselect itself
110
123
  # when running tests in parallel with gmake. Create a lock file while
111
124
  # we have the port here to ensure that does not happen .
112
125
  lock_path = "#{Dir::tmpdir}/unicorn_test.#{addr}:#{port}.lock"
113
- File.open(lock_path, File::WRONLY|File::CREAT|File::EXCL, 0600)
126
+ File.open(lock_path, File::WRONLY|File::CREAT|File::EXCL, 0600).close
114
127
  at_exit { File.unlink(lock_path) rescue nil }
115
128
  rescue Errno::EEXIST
116
129
  sock.close rescue nil
@@ -26,7 +26,6 @@ Gem::Specification.new do |s|
26
26
  s.files = manifest
27
27
  s.homepage = Wrongdoc.config[:rdoc_url]
28
28
  s.rdoc_options = rdoc_options
29
- s.require_paths = %w(lib ext)
30
29
  s.rubyforge_project = %q{mongrel}
31
30
  s.test_files = test_files
32
31
 
@@ -35,7 +34,7 @@ Gem::Specification.new do |s|
35
34
  # commented out. Nevertheless, upgrading to Rails 2.3.4 or later is
36
35
  # *strongly* recommended for security reasons.
37
36
  s.add_dependency(%q<rack>)
38
- s.add_dependency(%q<kgio>, '~> 2.2')
37
+ s.add_dependency(%q<kgio>, '~> 2.3')
39
38
 
40
39
  s.add_development_dependency('isolate', '~> 3.0.0')
41
40
  s.add_development_dependency('wrongdoc', '~> 1.5')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 3
8
- - 4
8
+ - 5
9
9
  - 0
10
- version: 3.4.0
10
+ version: 3.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Unicorn hackers
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-04 00:00:00 +00:00
18
+ date: 2011-03-15 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -40,11 +40,11 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- hash: 7
43
+ hash: 5
44
44
  segments:
45
45
  - 2
46
- - 2
47
- version: "2.2"
46
+ - 3
47
+ version: "2.3"
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
@@ -392,7 +392,6 @@ rdoc_options:
392
392
  - http://bogomips.org/unicorn.git/tree/%s
393
393
  require_paths:
394
394
  - lib
395
- - ext
396
395
  required_ruby_version: !ruby/object:Gem::Requirement
397
396
  none: false
398
397
  requirements:
@@ -414,7 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
414
413
  requirements: []
415
414
 
416
415
  rubyforge_project: mongrel
417
- rubygems_version: 1.3.7
416
+ rubygems_version: 1.6.1
418
417
  signing_key:
419
418
  specification_version: 3
420
419
  summary: Rack HTTP server for fast clients and Unix