unicorn 0.91.0 → 0.92.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGELOG → .CHANGELOG.old} +0 -0
- data/.document +4 -0
- data/.gitignore +5 -0
- data/.mailmap +26 -0
- data/CONTRIBUTORS +1 -1
- data/Documentation/.gitignore +5 -0
- data/Documentation/GNUmakefile +30 -0
- data/Documentation/unicorn.1.txt +158 -0
- data/Documentation/unicorn_rails.1.txt +150 -0
- data/GIT-VERSION-GEN +40 -0
- data/GNUmakefile +102 -14
- data/README +3 -2
- data/Rakefile +104 -32
- data/SIGNALS +2 -4
- data/TODO +3 -9
- data/bin/unicorn +5 -2
- data/bin/unicorn_rails +5 -3
- data/ext/unicorn_http/c_util.h +2 -2
- data/ext/unicorn_http/common_field_optimization.h +2 -1
- data/ext/unicorn_http/ext_help.h +29 -4
- data/ext/unicorn_http/extconf.rb +5 -0
- data/ext/unicorn_http/unicorn_http.rl +131 -76
- data/lib/unicorn.rb +6 -2
- data/lib/unicorn/app/exec_cgi.rb +3 -1
- data/lib/unicorn/app/inetd.rb +2 -0
- data/lib/unicorn/app/old_rails.rb +2 -0
- data/lib/unicorn/app/old_rails/static.rb +3 -1
- data/lib/unicorn/cgi_wrapper.rb +3 -1
- data/lib/unicorn/configurator.rb +2 -0
- data/lib/unicorn/const.rb +8 -6
- data/lib/unicorn/http_request.rb +6 -5
- data/lib/unicorn/http_response.rb +4 -2
- data/lib/unicorn/launcher.rb +6 -0
- data/lib/unicorn/socket_helper.rb +5 -5
- data/lib/unicorn/tee_input.rb +2 -0
- data/lib/unicorn/util.rb +2 -0
- data/local.mk.sample +4 -2
- data/setup.rb +1 -0
- data/test/aggregate.rb +2 -0
- data/test/exec/test_exec.rb +157 -0
- data/test/rails/app-1.2.3/app/controllers/application.rb +2 -0
- data/test/rails/app-1.2.3/app/controllers/foo_controller.rb +2 -0
- data/test/rails/app-1.2.3/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-1.2.3/config/boot.rb +2 -0
- data/test/rails/app-1.2.3/config/environment.rb +2 -0
- data/test/rails/app-1.2.3/config/environments/development.rb +2 -0
- data/test/rails/app-1.2.3/config/environments/production.rb +2 -0
- data/test/rails/app-1.2.3/config/routes.rb +2 -0
- data/test/rails/app-2.0.2/app/controllers/application.rb +2 -0
- data/test/rails/app-2.0.2/app/controllers/foo_controller.rb +2 -0
- data/test/rails/app-2.0.2/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-2.0.2/config/boot.rb +2 -0
- data/test/rails/app-2.0.2/config/environment.rb +2 -0
- data/test/rails/app-2.0.2/config/environments/development.rb +2 -0
- data/test/rails/app-2.0.2/config/environments/production.rb +2 -0
- data/test/rails/app-2.0.2/config/routes.rb +2 -0
- data/test/rails/app-2.1.2/app/controllers/application.rb +2 -0
- data/test/rails/app-2.1.2/app/controllers/foo_controller.rb +2 -0
- data/test/rails/app-2.1.2/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-2.1.2/config/boot.rb +2 -0
- data/test/rails/app-2.1.2/config/environment.rb +2 -0
- data/test/rails/app-2.1.2/config/environments/development.rb +2 -0
- data/test/rails/app-2.1.2/config/environments/production.rb +2 -0
- data/test/rails/app-2.1.2/config/routes.rb +2 -0
- data/test/rails/app-2.2.2/app/controllers/application.rb +2 -0
- data/test/rails/app-2.2.2/app/controllers/foo_controller.rb +2 -0
- data/test/rails/app-2.2.2/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-2.2.2/config/boot.rb +2 -0
- data/test/rails/app-2.2.2/config/environment.rb +2 -0
- data/test/rails/app-2.2.2/config/environments/development.rb +2 -0
- data/test/rails/app-2.2.2/config/environments/production.rb +2 -0
- data/test/rails/app-2.2.2/config/routes.rb +2 -0
- data/test/rails/app-2.3.3.1/app/controllers/application_controller.rb +2 -0
- data/test/rails/app-2.3.3.1/app/controllers/foo_controller.rb +2 -0
- data/test/rails/app-2.3.3.1/app/helpers/application_helper.rb +2 -0
- data/test/rails/app-2.3.3.1/config/boot.rb +2 -0
- data/test/rails/app-2.3.3.1/config/environment.rb +2 -0
- data/test/rails/app-2.3.3.1/config/environments/development.rb +2 -0
- data/test/rails/app-2.3.3.1/config/environments/production.rb +2 -0
- data/test/rails/app-2.3.3.1/config/routes.rb +2 -0
- data/test/rails/test_rails.rb +2 -0
- data/test/test_helper.rb +8 -0
- data/test/unit/test_configurator.rb +2 -0
- data/test/unit/test_http_parser.rb +13 -0
- data/test/unit/test_http_parser_ng.rb +2 -0
- data/test/unit/test_request.rb +2 -0
- data/test/unit/test_response.rb +2 -0
- data/test/unit/test_server.rb +2 -0
- data/test/unit/test_signals.rb +2 -0
- data/test/unit/test_socket_helper.rb +2 -0
- data/test/unit/test_tee_input.rb +2 -1
- data/test/unit/test_upload.rb +2 -0
- data/test/unit/test_util.rb +2 -0
- data/unicorn.gemspec +38 -28
- metadata +38 -42
- data/Manifest +0 -137
data/GNUmakefile
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
# use GNU Make to run tests in parallel, and without depending on Rubygems
|
2
2
|
all:: test
|
3
3
|
ruby = ruby
|
4
|
+
rake = rake
|
4
5
|
ragel = ragel
|
6
|
+
GIT_URL = $(shell git config --get remote.origin.url 2>/dev/null || \
|
7
|
+
echo git://git.bogomips.org/unicorn.git)
|
5
8
|
RLFLAGS = -G2
|
9
|
+
|
10
|
+
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
11
|
+
@./GIT-VERSION-GEN
|
12
|
+
-include GIT-VERSION-FILE
|
6
13
|
-include local.mk
|
7
14
|
ruby_bin := $(shell which $(ruby))
|
8
15
|
ifeq ($(DLEXT),) # "so" for Linux
|
@@ -29,8 +36,9 @@ test_prefix = $(CURDIR)/test/install-$(RUBY_VERSION)
|
|
29
36
|
|
30
37
|
ext := ext/unicorn_http
|
31
38
|
c_files := $(ext)/unicorn_http.c $(wildcard $(ext)/*.h)
|
32
|
-
rl_files := $(
|
33
|
-
|
39
|
+
rl_files := $(wildcard $(ext)/*.rl)
|
40
|
+
bins := $(wildcard bin/*)
|
41
|
+
rb_files := $(bins) $(shell find lib -type f -name '*.rb')
|
34
42
|
inst_deps := $(c_files) $(rb_files)
|
35
43
|
|
36
44
|
ragel: $(ext)/unicorn_http.c
|
@@ -48,13 +56,11 @@ http: lib/unicorn_http.$(DLEXT)
|
|
48
56
|
|
49
57
|
$(test_prefix)/.stamp: $(inst_deps)
|
50
58
|
mkdir -p $(test_prefix)/.ccache
|
51
|
-
tar c `cat
|
59
|
+
tar c `cat .manifest` | (cd $(test_prefix) && tar x)
|
52
60
|
$(MAKE) -C $(test_prefix) clean
|
53
61
|
$(MAKE) -C $(test_prefix) http shebang
|
54
62
|
> $@
|
55
63
|
|
56
|
-
bins := $(wildcard bin/*)
|
57
|
-
|
58
64
|
# this is only intended to be run within $(test_prefix)
|
59
65
|
shebang: $(bins)
|
60
66
|
$(ruby) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $^
|
@@ -119,20 +125,54 @@ prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
|
|
119
125
|
|
120
126
|
clean:
|
121
127
|
-$(MAKE) -C $(ext) clean
|
128
|
+
-$(MAKE) -C Documentation clean
|
122
129
|
$(RM) $(ext)/Makefile lib/unicorn_http.$(DLEXT)
|
123
130
|
$(RM) $(setup_rb_files) $(t_log)
|
124
|
-
$(RM) -r $(test_prefix)
|
125
|
-
|
126
|
-
|
127
|
-
|
131
|
+
$(RM) -r $(test_prefix) man
|
132
|
+
|
133
|
+
man:
|
134
|
+
$(MAKE) -C Documentation install-man
|
135
|
+
.manifest: GIT-VERSION-FILE NEWS ChangeLog $(ext)/unicorn_http.c
|
136
|
+
$(MAKE) man
|
137
|
+
(git ls-files && \
|
138
|
+
for i in $@ $^ $(wildcard man/*/*.1); \
|
139
|
+
do echo $$i; done) | LC_ALL=C sort > $@+
|
128
140
|
cmp $@+ $@ || mv $@+ $@
|
129
|
-
$(RM)
|
141
|
+
$(RM) $@+
|
142
|
+
|
143
|
+
NEWS: GIT-VERSION-FILE
|
144
|
+
$(rake) -s news_rdoc > $@+
|
145
|
+
mv $@+ $@
|
146
|
+
|
147
|
+
ChangeLog: GIT-VERSION-FILE
|
148
|
+
@echo "ChangeLog from $(GIT_URL) ($(GIT_VERSION))" > $@+
|
149
|
+
@echo >> $@+
|
150
|
+
git log | sed -e 's/^/ /' >> $@+
|
151
|
+
mv $@+ $@
|
152
|
+
|
153
|
+
news_atom := http://unicorn.bogomips.org/NEWS.atom.xml
|
154
|
+
cgit_atom := http://git.bogomips.org/cgit/unicorn.git/atom/?h=master
|
155
|
+
atom = <link rel="alternate" title="Atom feed" href="$(1)" \
|
156
|
+
type="application/atom+xml"/>
|
130
157
|
|
131
158
|
# using rdoc 2.4.1+
|
132
|
-
doc: .document $(ext)/unicorn_http.c
|
159
|
+
doc: .document $(ext)/unicorn_http.c NEWS ChangeLog
|
160
|
+
> unicorn.1 && > unicorn_rails.1
|
133
161
|
rdoc -Na -t "$(shell sed -ne '1s/^= //p' README)"
|
134
|
-
install -m644
|
135
|
-
|
162
|
+
install -m644 $(shell grep '^[A-Z]' .document) doc/
|
163
|
+
$(MAKE) -C Documentation install-html
|
164
|
+
cd doc && for i in unicorn unicorn_rails; do \
|
165
|
+
sed -e '/"documentation">/r man1/'$$i'.1.html' \
|
166
|
+
< $${i}_1.html > tmp && mv tmp $${i}_1.html; done
|
167
|
+
$(ruby) -i -p -e \
|
168
|
+
'$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
|
169
|
+
doc/ChangeLog.html
|
170
|
+
$(ruby) -i -p -e \
|
171
|
+
'$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
|
172
|
+
doc/NEWS.html doc/README.html
|
173
|
+
$(rake) -s news_atom > doc/NEWS.atom.xml
|
174
|
+
cd doc && ln README.html tmp && mv tmp index.html
|
175
|
+
$(RM) unicorn.1 unicorn_rails.1
|
136
176
|
|
137
177
|
rails_git_url = git://github.com/rails/rails.git
|
138
178
|
rails_git := vendor/rails.git
|
@@ -153,4 +193,52 @@ $(T_r).%.r: export RAILS_GIT_REPO = $(CURDIR)/$(rails_git)
|
|
153
193
|
$(T_r).%.r: $(test_prefix)/.stamp $(rails_git)/info/cloned-stamp
|
154
194
|
$(run_test)
|
155
195
|
|
156
|
-
|
196
|
+
ifneq ($(VERSION),)
|
197
|
+
rfproject := mongrel
|
198
|
+
rfpackage := unicorn
|
199
|
+
pkggem := pkg/$(rfpackage)-$(VERSION).gem
|
200
|
+
pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
|
201
|
+
release_notes := release_notes-$(VERSION)
|
202
|
+
release_changes := release_changes-$(VERSION)
|
203
|
+
|
204
|
+
release-notes: $(release_notes)
|
205
|
+
release-changes: $(release_changes)
|
206
|
+
$(release_changes):
|
207
|
+
$(rake) -s release_changes > $@+
|
208
|
+
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
209
|
+
$(release_notes):
|
210
|
+
GIT_URL=$(GIT_URL) $(rake) -s release_notes > $@+
|
211
|
+
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
212
|
+
|
213
|
+
# ensures we're actually on the tagged $(VERSION), only used for release
|
214
|
+
verify:
|
215
|
+
git rev-parse --verify refs/tags/v$(VERSION)^{}
|
216
|
+
git diff-index --quiet HEAD^0
|
217
|
+
test `git rev-parse --verify HEAD^0` = \
|
218
|
+
`git rev-parse --verify refs/tags/v$(VERSION)^{}`
|
219
|
+
|
220
|
+
$(pkggem): .manifest
|
221
|
+
gem build $(rfpackage).gemspec
|
222
|
+
mkdir -p pkg
|
223
|
+
mv $(@F) $@
|
224
|
+
|
225
|
+
$(pkgtgz): distdir = $(basename $@)
|
226
|
+
$(pkgtgz): HEAD = v$(VERSION)
|
227
|
+
$(pkgtgz): .manifest
|
228
|
+
@test -n "$(distdir)"
|
229
|
+
$(RM) -r $(distdir)
|
230
|
+
mkdir -p $(distdir)
|
231
|
+
tar c `cat .manifest` | (cd $(distdir) && tar x)
|
232
|
+
cd pkg && tar c $(basename $(@F)) | gzip -9 > $(@F)+
|
233
|
+
mv $@+ $@
|
234
|
+
|
235
|
+
package: $(pkgtgz) $(pkggem)
|
236
|
+
|
237
|
+
release: verify package $(release_notes) $(release_changes)
|
238
|
+
rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
|
239
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
240
|
+
rubyforge add_file \
|
241
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
242
|
+
endif
|
243
|
+
|
244
|
+
.PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) .manifest man
|
data/README
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
cut out everything that is better supported by the operating system,
|
7
7
|
{nginx}[http://nginx.net/] or {Rack}[http://rack.rubyforge.org/].
|
8
8
|
|
9
|
-
* Compatible with both Ruby 1.8 and 1.9
|
9
|
+
* Compatible with both Ruby 1.8 and 1.9. Rubinius support is in-progress.
|
10
10
|
|
11
11
|
* Process management: Unicorn will reap and restart workers that
|
12
12
|
die from broken apps. There is no need to manage multiple processes
|
@@ -53,7 +53,7 @@
|
|
53
53
|
|
54
54
|
== Versions
|
55
55
|
|
56
|
-
{Current v0.
|
56
|
+
{Current v0.92.0}[http://git.bogomips.org/cgit/unicorn.git/tag/?id=v0.92.0]
|
57
57
|
|
58
58
|
{Old Stable v0.8.4}[http://git.bogomips.org/cgit/unicorn.git/tag/?id=v0.8.4]
|
59
59
|
|
@@ -166,3 +166,4 @@ to post on the mailing list. No top posting. Address replies +To:+ (or
|
|
166
166
|
* nntp: nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
|
167
167
|
* archives: http://rubyforge.org/pipermail/mongrel-unicorn/
|
168
168
|
* subscribe: http://rubyforge.org/mailman/listinfo/mongrel-unicorn/
|
169
|
+
* finger: unicorn@bogomips.org
|
data/Rakefile
CHANGED
@@ -1,38 +1,110 @@
|
|
1
|
+
# -*- encoding: binary -*-
|
1
2
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
3
|
+
# most tasks are in the GNUmakefile which offers better parallelism
|
4
|
+
|
5
|
+
def old_summaries
|
6
|
+
@old_summaries ||= File.readlines(".CHANGELOG.old").inject({}) do |hash, line|
|
7
|
+
version, summary = line.split(/ - /, 2)
|
8
|
+
hash[version] = summary
|
9
|
+
hash
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def tags
|
14
|
+
timefmt = '%Y-%m-%dT%H:%M:%SZ'
|
15
|
+
@tags ||= `git tag -l`.split(/\n/).map do |tag|
|
16
|
+
next if tag == "v0.0.0"
|
17
|
+
if %r{\Av[\d\.]+\z} =~ tag
|
18
|
+
header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
|
19
|
+
header = header.split(/\n/)
|
20
|
+
tagger = header.grep(/\Atagger /).first
|
21
|
+
body ||= "initial"
|
22
|
+
{
|
23
|
+
:time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
|
24
|
+
:tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1],
|
25
|
+
:tagger_email => %r{<([^>]+)>}.match(tagger)[1],
|
26
|
+
:id => `git rev-parse refs/tags/#{tag}`.chomp!,
|
27
|
+
:tag => tag,
|
28
|
+
:subject => subject,
|
29
|
+
:body => (old = old_summaries[tag]) ? "#{old}\n#{body}" : body,
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end.compact.sort { |a,b| b[:time] <=> a[:time] }
|
33
|
+
end
|
34
|
+
|
35
|
+
cgit_url = "http://git.bogomips.org/cgit/unicorn.git"
|
36
|
+
|
37
|
+
desc 'prints news as an Atom feed'
|
38
|
+
task :news_atom do
|
39
|
+
require 'nokogiri'
|
40
|
+
new_tags = tags[0,10]
|
41
|
+
puts(Nokogiri::XML::Builder.new do
|
42
|
+
feed :xmlns => "http://www.w3.org/2005/Atom" do
|
43
|
+
id! "http://unicorn.bogomips.org/NEWS.atom.xml"
|
44
|
+
title "Unicorn news"
|
45
|
+
subtitle "Rack HTTP server for Unix and fast clients"
|
46
|
+
link! :rel => 'alternate', :type => 'text/html',
|
47
|
+
:href => 'http://unicorn.bogomips.org/NEWS.html'
|
48
|
+
updated new_tags.first[:time]
|
49
|
+
new_tags.each do |tag|
|
50
|
+
entry do
|
51
|
+
title tag[:subject]
|
52
|
+
updated tag[:time]
|
53
|
+
published tag[:time]
|
54
|
+
author {
|
55
|
+
name tag[:tagger_name]
|
56
|
+
email tag[:tagger_email]
|
57
|
+
}
|
58
|
+
url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
|
59
|
+
link! :rel => "alternate", :type => "text/html", :href =>url
|
60
|
+
id! url
|
61
|
+
content(:type => 'text') { tag[:body] }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end.to_xml)
|
26
66
|
end
|
27
67
|
|
28
|
-
|
68
|
+
desc 'prints RDoc-formatted news'
|
69
|
+
task :news_rdoc do
|
70
|
+
tags.each do |tag|
|
71
|
+
time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
|
72
|
+
puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
|
73
|
+
puts ""
|
29
74
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
target = "unicorn_http.c"
|
34
|
-
File.unlink target if File.exist? target
|
35
|
-
sh "ragel unicorn_http.rl -C -G2 -o #{target}"
|
36
|
-
raise "Failed to build C source" unless File.exist? target
|
75
|
+
body = tag[:body]
|
76
|
+
puts tag[:body].gsub(/^/sm, " ").gsub!(/[ \t]+$/sm, "")
|
77
|
+
puts ""
|
37
78
|
end
|
38
79
|
end
|
80
|
+
|
81
|
+
desc "print release changelog for Rubyforge"
|
82
|
+
task :release_changes do
|
83
|
+
version = ENV['VERSION'] or abort "VERSION= needed"
|
84
|
+
version = "v#{version}"
|
85
|
+
vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
|
86
|
+
prev = vtags[vtags.index(version) - 1]
|
87
|
+
system('git', 'diff', '--stat', prev, version) or abort $?
|
88
|
+
puts ""
|
89
|
+
system('git', 'log', "#{prev}..#{version}") or abort $?
|
90
|
+
end
|
91
|
+
|
92
|
+
desc "print release notes for Rubyforge"
|
93
|
+
task :release_notes do
|
94
|
+
require 'rubygems'
|
95
|
+
|
96
|
+
git_url = ENV['GIT_URL'] ||
|
97
|
+
`git config --get remote.origin.url 2>/dev/null`.chomp! ||
|
98
|
+
'git://git.bogomips.org/unicorn.git'
|
99
|
+
|
100
|
+
spec = Gem::Specification.load('unicorn.gemspec')
|
101
|
+
puts spec.description.strip
|
102
|
+
puts ""
|
103
|
+
puts "* #{spec.homepage}"
|
104
|
+
puts "* #{spec.email}"
|
105
|
+
puts "* #{git_url}"
|
106
|
+
|
107
|
+
_, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
|
108
|
+
print "\nChanges:\n\n"
|
109
|
+
puts body
|
110
|
+
end
|
data/SIGNALS
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
== Signal handling
|
2
2
|
|
3
3
|
In general, signals need only be sent to the master process. However,
|
4
|
-
the signals
|
4
|
+
the signals Unicorn uses internally to communicate with the worker
|
5
5
|
processes are documented here as well.
|
6
6
|
|
7
7
|
=== Master Process
|
@@ -54,9 +54,7 @@ losing any incoming connections. Doing so will reload all of your
|
|
54
54
|
application code, Unicorn config, Ruby executable, and all libraries.
|
55
55
|
The only things that will not change (due to OS limitations) are:
|
56
56
|
|
57
|
-
1. The
|
58
|
-
|
59
|
-
2. The path to the unicorn executable script. If you want to change to
|
57
|
+
1. The path to the unicorn executable script. If you want to change to
|
60
58
|
a different installation of Ruby, you can modify the shebang
|
61
59
|
line to point to your alternative interpreter.
|
62
60
|
|
data/TODO
CHANGED
@@ -1,11 +1,5 @@
|
|
1
|
-
*
|
1
|
+
* Documentation improvements
|
2
2
|
|
3
|
-
*
|
3
|
+
* launchers - add --kill switch to allow DRY pid file path definition
|
4
4
|
|
5
|
-
*
|
6
|
-
|
7
|
-
* launchers - add stop/start/kill/upgrade commands
|
8
|
-
|
9
|
-
* Rainbows!
|
10
|
-
|
11
|
-
* Rubinius support
|
5
|
+
* Rainbows! (http://article.gmane.org/gmane.comp.lang.ruby.unicorn.general/22)
|
data/bin/unicorn
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/home/ew/bin/ruby
|
2
|
+
# -*- encoding: binary -*-
|
2
3
|
require 'unicorn/launcher'
|
3
4
|
require 'optparse'
|
4
5
|
|
@@ -64,7 +65,9 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
64
65
|
daemonize = d ? true : false
|
65
66
|
end
|
66
67
|
|
67
|
-
opts.on("-P", "--pid FILE", "
|
68
|
+
opts.on("-P", "--pid FILE", "DEPRECATED") do |f|
|
69
|
+
warn %q{Use of --pid/-P is strongly discouraged}
|
70
|
+
warn %q{Use the 'pid' directive in the Unicorn config file instead}
|
68
71
|
options[:pid] = File.expand_path(f)
|
69
72
|
end
|
70
73
|
|
@@ -93,7 +96,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
93
96
|
opts.separator "Common options:"
|
94
97
|
|
95
98
|
opts.on_tail("-h", "--help", "Show this message") do
|
96
|
-
puts opts
|
99
|
+
puts opts.to_s.gsub(/^.*DEPRECATED.*$/s, '')
|
97
100
|
exit
|
98
101
|
end
|
99
102
|
|
data/bin/unicorn_rails
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/home/ew/bin/ruby
|
2
|
+
# -*- encoding: binary -*-
|
2
3
|
require 'unicorn/launcher'
|
3
4
|
require 'optparse'
|
4
5
|
require 'fileutils'
|
@@ -78,8 +79,9 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
78
79
|
options[:config_file] = File.expand_path(f)
|
79
80
|
end
|
80
81
|
|
81
|
-
opts.on("-P", "--path PATH", "
|
82
|
-
|
82
|
+
opts.on("-P", "--path PATH", "DEPRECATED") do |v|
|
83
|
+
warn %q{Use of --path/-P is strongly discouraged}
|
84
|
+
warn %q{Use the 'map' directive in the rackup config instead}
|
83
85
|
ENV['RAILS_RELATIVE_URL_ROOT'] = map_path = v
|
84
86
|
end
|
85
87
|
|
@@ -91,7 +93,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
91
93
|
opts.separator "Common options:"
|
92
94
|
|
93
95
|
opts.on_tail("-h", "--help", "Show this message") do
|
94
|
-
puts opts
|
96
|
+
puts opts.to_s.gsub(/^.*DEPRECATED.*$/s, '')
|
95
97
|
exit
|
96
98
|
end
|
97
99
|
|
data/ext/unicorn_http/c_util.h
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
# endif
|
28
28
|
#else
|
29
29
|
# error off_t size unknown for this platform!
|
30
|
-
#endif
|
30
|
+
#endif /* SIZEOF_OFF_T check */
|
31
31
|
|
32
32
|
/*
|
33
33
|
* capitalizes all lower-case ASCII characters and converts dashes
|
@@ -56,7 +56,7 @@ static int hexchar2int(int xdigit)
|
|
56
56
|
return xdigit - 'a' + 10;
|
57
57
|
|
58
58
|
/* Ragel already does runtime range checking for us in Unicorn: */
|
59
|
-
assert(xdigit >= '0' && xdigit <= '9');
|
59
|
+
assert(xdigit >= '0' && xdigit <= '9' && "invalid digit character");
|
60
60
|
|
61
61
|
return xdigit - '0';
|
62
62
|
}
|
@@ -103,7 +103,8 @@ static VALUE uncommon_field(const char *field, size_t flen)
|
|
103
103
|
VALUE f = rb_str_new(NULL, HTTP_PREFIX_LEN + flen);
|
104
104
|
memcpy(RSTRING_PTR(f), HTTP_PREFIX, HTTP_PREFIX_LEN);
|
105
105
|
memcpy(RSTRING_PTR(f) + HTTP_PREFIX_LEN, field, flen);
|
106
|
-
assert(*(RSTRING_PTR(f) + RSTRING_LEN(f)) == '\0'
|
106
|
+
assert(*(RSTRING_PTR(f) + RSTRING_LEN(f)) == '\0' &&
|
107
|
+
"string didn't end with \\0"); /* paranoia */
|
107
108
|
return rb_obj_freeze(f);
|
108
109
|
}
|
109
110
|
|
data/ext/unicorn_http/ext_help.h
CHANGED
@@ -3,10 +3,15 @@
|
|
3
3
|
|
4
4
|
#ifndef RSTRING_PTR
|
5
5
|
#define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
6
|
-
#endif
|
6
|
+
#endif /* !defined(RSTRING_PTR) */
|
7
7
|
#ifndef RSTRING_LEN
|
8
8
|
#define RSTRING_LEN(s) (RSTRING(s)->len)
|
9
|
-
#endif
|
9
|
+
#endif /* !defined(RSTRING_LEN) */
|
10
|
+
|
11
|
+
#ifndef RUBINIUS
|
12
|
+
# define rb_str_update(x) do {} while (0)
|
13
|
+
# define rb_str_flush(x) do {} while (0)
|
14
|
+
#endif /* !RUBINIUS */
|
10
15
|
|
11
16
|
#ifndef HAVE_RB_STR_SET_LEN
|
12
17
|
/* this is taken from Ruby 1.8.7, 1.8.6 may not have it */
|
@@ -14,9 +19,29 @@ static void rb_18_str_set_len(VALUE str, long len)
|
|
14
19
|
{
|
15
20
|
RSTRING(str)->len = len;
|
16
21
|
RSTRING(str)->ptr[len] = '\0';
|
22
|
+
rb_str_flush(str);
|
17
23
|
}
|
18
24
|
# define rb_str_set_len(str,len) rb_18_str_set_len(str,len)
|
19
|
-
#endif
|
25
|
+
#endif /* !defined(HAVE_RB_STR_SET_LEN) */
|
26
|
+
|
27
|
+
/* not all Ruby implementations support frozen objects (Rubinius does not) */
|
28
|
+
#if defined(OBJ_FROZEN)
|
29
|
+
# define assert_frozen(f) assert(OBJ_FROZEN(f) && "unfrozen object")
|
30
|
+
#else
|
31
|
+
# define assert_frozen(f) do {} while (0)
|
32
|
+
#endif /* !defined(OBJ_FROZEN) */
|
33
|
+
|
34
|
+
#if !defined(OFFT2NUM)
|
35
|
+
# if SIZEOF_OFF_T == SIZEOF_LONG
|
36
|
+
# define OFFT2NUM(n) LONG2NUM(n)
|
37
|
+
# else
|
38
|
+
# define OFFT2NUM(n) LL2NUM(n)
|
39
|
+
# endif
|
40
|
+
#endif /* ! defined(OFFT2NUM) */
|
41
|
+
|
42
|
+
#ifndef HAVE_RB_STR_MODIFY
|
43
|
+
# define rb_str_modify(x) do {} while (0)
|
44
|
+
#endif /* ! defined(HAVE_RB_STR_MODIFY) */
|
20
45
|
|
21
46
|
static inline int str_cstr_eq(VALUE val, const char *ptr, size_t len)
|
22
47
|
{
|
@@ -45,4 +70,4 @@ static int str_cstr_case_eq(VALUE val, const char *ptr, size_t len)
|
|
45
70
|
#define STR_CSTR_CASE_EQ(val, const_str) \
|
46
71
|
str_cstr_case_eq(val, const_str, sizeof(const_str) - 1)
|
47
72
|
|
48
|
-
#endif
|
73
|
+
#endif /* ext_help_h */
|