mini-pure-gem 0.0.1

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.
Files changed (157) hide show
  1. checksums.yaml +7 -0
  2. data/mini-pure-gem.gemspec +11 -0
  3. data/unicorn-6.1.0/Application_Timeouts +77 -0
  4. data/unicorn-6.1.0/CONTRIBUTORS +39 -0
  5. data/unicorn-6.1.0/COPYING +674 -0
  6. data/unicorn-6.1.0/DESIGN +95 -0
  7. data/unicorn-6.1.0/Documentation/unicorn.1 +222 -0
  8. data/unicorn-6.1.0/Documentation/unicorn_rails.1 +207 -0
  9. data/unicorn-6.1.0/FAQ +70 -0
  10. data/unicorn-6.1.0/GIT-VERSION-FILE +1 -0
  11. data/unicorn-6.1.0/GIT-VERSION-GEN +39 -0
  12. data/unicorn-6.1.0/GNUmakefile +313 -0
  13. data/unicorn-6.1.0/HACKING +112 -0
  14. data/unicorn-6.1.0/ISSUES +97 -0
  15. data/unicorn-6.1.0/KNOWN_ISSUES +79 -0
  16. data/unicorn-6.1.0/LATEST +24 -0
  17. data/unicorn-6.1.0/LICENSE +67 -0
  18. data/unicorn-6.1.0/Links +58 -0
  19. data/unicorn-6.1.0/NEWS +2890 -0
  20. data/unicorn-6.1.0/PHILOSOPHY +139 -0
  21. data/unicorn-6.1.0/README +151 -0
  22. data/unicorn-6.1.0/Rakefile +16 -0
  23. data/unicorn-6.1.0/SIGNALS +123 -0
  24. data/unicorn-6.1.0/Sandbox +104 -0
  25. data/unicorn-6.1.0/TODO +3 -0
  26. data/unicorn-6.1.0/TUNING +119 -0
  27. data/unicorn-6.1.0/archive/slrnpull.conf +4 -0
  28. data/unicorn-6.1.0/bin/unicorn +128 -0
  29. data/unicorn-6.1.0/bin/unicorn_rails +209 -0
  30. data/unicorn-6.1.0/examples/big_app_gc.rb +2 -0
  31. data/unicorn-6.1.0/examples/echo.ru +27 -0
  32. data/unicorn-6.1.0/examples/init.sh +102 -0
  33. data/unicorn-6.1.0/examples/logger_mp_safe.rb +25 -0
  34. data/unicorn-6.1.0/examples/logrotate.conf +44 -0
  35. data/unicorn-6.1.0/examples/nginx.conf +156 -0
  36. data/unicorn-6.1.0/examples/unicorn.conf.minimal.rb +13 -0
  37. data/unicorn-6.1.0/examples/unicorn.conf.rb +110 -0
  38. data/unicorn-6.1.0/examples/unicorn.socket +11 -0
  39. data/unicorn-6.1.0/examples/unicorn@.service +40 -0
  40. data/unicorn-6.1.0/ext/unicorn_http/CFLAGS +13 -0
  41. data/unicorn-6.1.0/ext/unicorn_http/c_util.h +116 -0
  42. data/unicorn-6.1.0/ext/unicorn_http/common_field_optimization.h +128 -0
  43. data/unicorn-6.1.0/ext/unicorn_http/epollexclusive.h +124 -0
  44. data/unicorn-6.1.0/ext/unicorn_http/ext_help.h +38 -0
  45. data/unicorn-6.1.0/ext/unicorn_http/extconf.rb +37 -0
  46. data/unicorn-6.1.0/ext/unicorn_http/global_variables.h +97 -0
  47. data/unicorn-6.1.0/ext/unicorn_http/httpdate.c +79 -0
  48. data/unicorn-6.1.0/ext/unicorn_http/unicorn_http.c +4319 -0
  49. data/unicorn-6.1.0/ext/unicorn_http/unicorn_http.rl +1025 -0
  50. data/unicorn-6.1.0/ext/unicorn_http/unicorn_http_common.rl +76 -0
  51. data/unicorn-6.1.0/lib/unicorn/app/old_rails/static.rb +59 -0
  52. data/unicorn-6.1.0/lib/unicorn/app/old_rails.rb +35 -0
  53. data/unicorn-6.1.0/lib/unicorn/cgi_wrapper.rb +147 -0
  54. data/unicorn-6.1.0/lib/unicorn/configurator.rb +743 -0
  55. data/unicorn-6.1.0/lib/unicorn/const.rb +21 -0
  56. data/unicorn-6.1.0/lib/unicorn/http_request.rb +201 -0
  57. data/unicorn-6.1.0/lib/unicorn/http_response.rb +61 -0
  58. data/unicorn-6.1.0/lib/unicorn/http_server.rb +893 -0
  59. data/unicorn-6.1.0/lib/unicorn/launcher.rb +62 -0
  60. data/unicorn-6.1.0/lib/unicorn/oob_gc.rb +81 -0
  61. data/unicorn-6.1.0/lib/unicorn/preread_input.rb +33 -0
  62. data/unicorn-6.1.0/lib/unicorn/select_waiter.rb +6 -0
  63. data/unicorn-6.1.0/lib/unicorn/socket_helper.rb +211 -0
  64. data/unicorn-6.1.0/lib/unicorn/stream_input.rb +147 -0
  65. data/unicorn-6.1.0/lib/unicorn/tee_input.rb +131 -0
  66. data/unicorn-6.1.0/lib/unicorn/tmpio.rb +33 -0
  67. data/unicorn-6.1.0/lib/unicorn/util.rb +90 -0
  68. data/unicorn-6.1.0/lib/unicorn/version.rb +1 -0
  69. data/unicorn-6.1.0/lib/unicorn/worker.rb +165 -0
  70. data/unicorn-6.1.0/lib/unicorn.rb +138 -0
  71. data/unicorn-6.1.0/man/man1/unicorn.1 +222 -0
  72. data/unicorn-6.1.0/man/man1/unicorn_rails.1 +207 -0
  73. data/unicorn-6.1.0/setup.rb +1586 -0
  74. data/unicorn-6.1.0/t/GNUmakefile +5 -0
  75. data/unicorn-6.1.0/t/README +42 -0
  76. data/unicorn-6.1.0/t/bin/content-md5-put +36 -0
  77. data/unicorn-6.1.0/t/bin/sha1sum.rb +17 -0
  78. data/unicorn-6.1.0/t/bin/unused_listen +40 -0
  79. data/unicorn-6.1.0/t/broken-app.ru +12 -0
  80. data/unicorn-6.1.0/t/detach.ru +11 -0
  81. data/unicorn-6.1.0/t/env.ru +3 -0
  82. data/unicorn-6.1.0/t/fails-rack-lint.ru +5 -0
  83. data/unicorn-6.1.0/t/heartbeat-timeout.ru +12 -0
  84. data/unicorn-6.1.0/t/listener_names.ru +4 -0
  85. data/unicorn-6.1.0/t/my-tap-lib.sh +201 -0
  86. data/unicorn-6.1.0/t/oob_gc.ru +20 -0
  87. data/unicorn-6.1.0/t/oob_gc_path.ru +20 -0
  88. data/unicorn-6.1.0/t/pid.ru +3 -0
  89. data/unicorn-6.1.0/t/preread_input.ru +17 -0
  90. data/unicorn-6.1.0/t/rack-input-tests.ru +21 -0
  91. data/unicorn-6.1.0/t/t0000-http-basic.sh +50 -0
  92. data/unicorn-6.1.0/t/t0001-reload-bad-config.sh +53 -0
  93. data/unicorn-6.1.0/t/t0002-config-conflict.sh +49 -0
  94. data/unicorn-6.1.0/t/t0002-parser-error.sh +94 -0
  95. data/unicorn-6.1.0/t/t0003-working_directory.sh +51 -0
  96. data/unicorn-6.1.0/t/t0004-heartbeat-timeout.sh +69 -0
  97. data/unicorn-6.1.0/t/t0004-working_directory_broken.sh +24 -0
  98. data/unicorn-6.1.0/t/t0005-working_directory_app.rb.sh +40 -0
  99. data/unicorn-6.1.0/t/t0006-reopen-logs.sh +83 -0
  100. data/unicorn-6.1.0/t/t0006.ru +13 -0
  101. data/unicorn-6.1.0/t/t0007-working_directory_no_embed_cli.sh +44 -0
  102. data/unicorn-6.1.0/t/t0008-back_out_of_upgrade.sh +110 -0
  103. data/unicorn-6.1.0/t/t0009-broken-app.sh +56 -0
  104. data/unicorn-6.1.0/t/t0009-winch_ttin.sh +59 -0
  105. data/unicorn-6.1.0/t/t0010-reap-logging.sh +55 -0
  106. data/unicorn-6.1.0/t/t0011-active-unix-socket.sh +79 -0
  107. data/unicorn-6.1.0/t/t0012-reload-empty-config.sh +86 -0
  108. data/unicorn-6.1.0/t/t0013-rewindable-input-false.sh +24 -0
  109. data/unicorn-6.1.0/t/t0013.ru +12 -0
  110. data/unicorn-6.1.0/t/t0014-rewindable-input-true.sh +24 -0
  111. data/unicorn-6.1.0/t/t0014.ru +12 -0
  112. data/unicorn-6.1.0/t/t0015-configurator-internals.sh +25 -0
  113. data/unicorn-6.1.0/t/t0018-write-on-close.sh +23 -0
  114. data/unicorn-6.1.0/t/t0019-max_header_len.sh +49 -0
  115. data/unicorn-6.1.0/t/t0020-at_exit-handler.sh +49 -0
  116. data/unicorn-6.1.0/t/t0021-process_detach.sh +29 -0
  117. data/unicorn-6.1.0/t/t0022-listener_names-preload_app.sh +32 -0
  118. data/unicorn-6.1.0/t/t0100-rack-input-tests.sh +124 -0
  119. data/unicorn-6.1.0/t/t0116-client_body_buffer_size.sh +80 -0
  120. data/unicorn-6.1.0/t/t0116.ru +16 -0
  121. data/unicorn-6.1.0/t/t0300-no-default-middleware.sh +20 -0
  122. data/unicorn-6.1.0/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
  123. data/unicorn-6.1.0/t/t0301.ru +13 -0
  124. data/unicorn-6.1.0/t/t9000-preread-input.sh +48 -0
  125. data/unicorn-6.1.0/t/t9001-oob_gc.sh +47 -0
  126. data/unicorn-6.1.0/t/t9002-oob_gc-path.sh +75 -0
  127. data/unicorn-6.1.0/t/test-lib.sh +129 -0
  128. data/unicorn-6.1.0/t/write-on-close.ru +11 -0
  129. data/unicorn-6.1.0/test/aggregate.rb +15 -0
  130. data/unicorn-6.1.0/test/benchmark/README +60 -0
  131. data/unicorn-6.1.0/test/benchmark/dd.ru +18 -0
  132. data/unicorn-6.1.0/test/benchmark/ddstream.ru +50 -0
  133. data/unicorn-6.1.0/test/benchmark/readinput.ru +40 -0
  134. data/unicorn-6.1.0/test/benchmark/stack.ru +8 -0
  135. data/unicorn-6.1.0/test/benchmark/uconnect.perl +66 -0
  136. data/unicorn-6.1.0/test/exec/README +5 -0
  137. data/unicorn-6.1.0/test/exec/test_exec.rb +1101 -0
  138. data/unicorn-6.1.0/test/test_helper.rb +306 -0
  139. data/unicorn-6.1.0/test/unit/test_ccc.rb +91 -0
  140. data/unicorn-6.1.0/test/unit/test_configurator.rb +175 -0
  141. data/unicorn-6.1.0/test/unit/test_droplet.rb +28 -0
  142. data/unicorn-6.1.0/test/unit/test_http_parser.rb +884 -0
  143. data/unicorn-6.1.0/test/unit/test_http_parser_ng.rb +714 -0
  144. data/unicorn-6.1.0/test/unit/test_request.rb +182 -0
  145. data/unicorn-6.1.0/test/unit/test_response.rb +111 -0
  146. data/unicorn-6.1.0/test/unit/test_server.rb +342 -0
  147. data/unicorn-6.1.0/test/unit/test_signals.rb +188 -0
  148. data/unicorn-6.1.0/test/unit/test_socket_helper.rb +201 -0
  149. data/unicorn-6.1.0/test/unit/test_stream_input.rb +203 -0
  150. data/unicorn-6.1.0/test/unit/test_tee_input.rb +304 -0
  151. data/unicorn-6.1.0/test/unit/test_upload.rb +301 -0
  152. data/unicorn-6.1.0/test/unit/test_util.rb +131 -0
  153. data/unicorn-6.1.0/test/unit/test_waiter.rb +34 -0
  154. data/unicorn-6.1.0/unicorn.gemspec +49 -0
  155. data/unicorn-6.1.0/unicorn_1 +1 -0
  156. data/unicorn-6.1.0/unicorn_rails_1 +1 -0
  157. metadata +195 -0
@@ -0,0 +1,313 @@
1
+ # use GNU Make to run tests in parallel, and without depending on RubyGems
2
+ all:: test
3
+
4
+ RLFLAGS = -G2
5
+
6
+ MRI = ruby
7
+ RUBY = ruby
8
+ RAKE = rake
9
+ RAGEL = ragel
10
+ RSYNC = rsync
11
+ OLDDOC = olddoc
12
+ RDOC = rdoc
13
+ INSTALL = install
14
+
15
+ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
16
+ @./GIT-VERSION-GEN
17
+ -include GIT-VERSION-FILE
18
+ -include local.mk
19
+ ruby_bin := $(shell which $(RUBY))
20
+ ifeq ($(DLEXT),) # "so" for Linux
21
+ DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts RbConfig::CONFIG["DLEXT"]')
22
+ endif
23
+ ifeq ($(RUBY_VERSION),)
24
+ RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
25
+ endif
26
+
27
+ RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
28
+
29
+ # we should never package more than one ext to avoid DSO proliferation:
30
+ # https://udrepper.livejournal.com/8790.html
31
+ ext := $(firstword $(wildcard ext/*))
32
+
33
+ ragel: $(ext)/unicorn_http.c
34
+
35
+ rl_files := $(wildcard $(ext)/*.rl)
36
+ ragel: $(ext)/unicorn_http.c
37
+ $(ext)/unicorn_http.c: $(rl_files)
38
+ cd $(@D) && $(RAGEL) unicorn_http.rl -C $(RLFLAGS) -o $(@F)
39
+ ext_pfx := test/$(RUBY_ENGINE)-$(RUBY_VERSION)
40
+ tmp_bin := $(ext_pfx)/bin
41
+ ext_h := $(wildcard $(ext)/*/*.h $(ext)/*.h)
42
+ ext_src := $(sort $(wildcard $(ext)/*.c) $(ext_h) $(ext)/unicorn_http.c)
43
+ ext_pfx_src := $(addprefix $(ext_pfx)/,$(ext_src))
44
+ ext_dir := $(ext_pfx)/$(ext)
45
+ $(ext)/extconf.rb:
46
+ @>>$@
47
+ $(ext_dir) $(tmp_bin) man/man1 doc/man1 pkg t/trash:
48
+ @mkdir -p $@
49
+ $(ext_pfx)/$(ext)/%: $(ext)/% | $(ext_dir)
50
+ $(INSTALL) -m 644 $< $@
51
+ $(ext_pfx)/$(ext)/Makefile: $(ext)/extconf.rb | $(ext_dir)
52
+ $(RM) -f $(@D)/*.o
53
+ cd $(@D) && $(RUBY) $(CURDIR)/$(ext)/extconf.rb $(EXTCONF_ARGS)
54
+ ext_sfx := _ext.$(DLEXT)
55
+ ext_dl := $(ext_pfx)/$(ext)/$(notdir $(ext)_ext.$(DLEXT))
56
+ $(ext_dl): $(ext_src) $(ext_pfx_src) $(ext_pfx)/$(ext)/Makefile
57
+ $(MAKE) -C $(@D)
58
+ lib := $(CURDIR)/lib:$(CURDIR)/$(ext_pfx)/$(ext)
59
+ http build: $(ext_dl)
60
+ $(ext_pfx)/$(ext)/unicorn_http.c: ext/unicorn_http/unicorn_http.c
61
+
62
+ # dunno how to implement this as concisely in Ruby, and hell, I love awk
63
+ awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}' 2>/dev/null
64
+
65
+ slow_tests := test/unit/test_server.rb test/exec/test_exec.rb \
66
+ test/unit/test_signals.rb test/unit/test_upload.rb
67
+ log_suffix = .$(RUBY_ENGINE).$(RUBY_VERSION).log
68
+ T := $(filter-out $(slow_tests), $(wildcard test/*/test*.rb))
69
+ T_n := $(shell $(awk_slow) $(slow_tests))
70
+ T_log := $(subst .rb,$(log_suffix),$(T))
71
+ T_n_log := $(subst .n,$(log_suffix),$(T_n))
72
+
73
+ base_bins := unicorn unicorn_rails
74
+ bins := $(addprefix bin/, $(base_bins))
75
+ man1_rdoc := $(addsuffix _1, $(base_bins))
76
+ man1_bins := $(addsuffix .1, $(base_bins))
77
+ man1_paths := $(addprefix man/man1/, $(man1_bins))
78
+ tmp_bins = $(addprefix $(tmp_bin)/, unicorn unicorn_rails)
79
+ pid := $(shell echo $$PPID)
80
+
81
+ $(tmp_bin)/%: bin/% | $(tmp_bin)
82
+ $(INSTALL) -m 755 $< $@.$(pid)
83
+ $(MRI) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@.$(pid)
84
+ mv $@.$(pid) $@
85
+
86
+ bins: $(tmp_bins)
87
+
88
+ t_log := $(T_log) $(T_n_log)
89
+ test: $(T) $(T_n)
90
+ @cat $(t_log) | $(MRI) test/aggregate.rb
91
+ @$(RM) $(t_log)
92
+
93
+ test-exec: $(wildcard test/exec/test_*.rb)
94
+ test-unit: $(wildcard test/unit/test_*.rb)
95
+ $(slow_tests): $(ext_dl)
96
+ @$(MAKE) $(shell $(awk_slow) $@)
97
+
98
+ # ensure we can require just the HTTP parser without the rest of unicorn
99
+ test-require: $(ext_dl)
100
+ $(RUBY) --disable-gems -I$(ext_pfx)/$(ext) -runicorn_http -e Unicorn
101
+
102
+ test_prereq := $(tmp_bins) $(ext_dl)
103
+
104
+ SH_TEST_OPTS =
105
+ ifdef V
106
+ ifeq ($(V),2)
107
+ SH_TEST_OPTS += --trace
108
+ else
109
+ SH_TEST_OPTS += --verbose
110
+ endif
111
+ endif
112
+
113
+ # do we trust Ruby behavior to be stable? some tests are
114
+ # (mostly) POSIX sh (not bash or ksh93, so no "set -o pipefail"
115
+ # TRACER = strace -f -o $(t_pfx).strace -s 100000
116
+ # TRACER = /usr/bin/time -o $(t_pfx).time
117
+ t_pfx = trash/$@-$(RUBY_ENGINE)-$(RUBY_VERSION)
118
+ T_sh = $(wildcard t/t[0-9][0-9][0-9][0-9]-*.sh)
119
+ $(T_sh): export RUBY := $(RUBY)
120
+ $(T_sh): export PATH := $(CURDIR)/$(tmp_bin):$(PATH)
121
+ $(T_sh): export RUBYLIB := $(lib):$(RUBYLIB)
122
+ $(T_sh): dep $(test_prereq) t/random_blob t/trash/.gitignore
123
+ cd t && $(TRACER) $(SHELL) $(SH_TEST_OPTS) $(@F) $(TEST_OPTS)
124
+
125
+ t/trash/.gitignore : | t/trash
126
+ echo '*' >$@
127
+
128
+ dependencies := socat curl
129
+ deps := $(addprefix t/.dep+,$(dependencies))
130
+ $(deps): dep_bin = $(lastword $(subst +, ,$@))
131
+ $(deps):
132
+ @which $(dep_bin) > $@.$(pid) 2>/dev/null || :
133
+ @test -s $@.$(pid) || \
134
+ { echo >&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit 1; }
135
+ @mv $@.$(pid) $@
136
+ dep: $(deps)
137
+
138
+ t/random_blob:
139
+ dd if=/dev/urandom bs=1M count=30 of=$@.$(pid)
140
+ mv $@.$(pid) $@
141
+
142
+ test-integration: $(T_sh)
143
+
144
+ check: test-require test test-integration
145
+ test-all: check
146
+
147
+ TEST_OPTS = -v
148
+ check_test = grep '0 failures, 0 errors' $(t) >/dev/null
149
+ ifndef V
150
+ quiet_pre = @echo '* $(arg)$(extra)';
151
+ quiet_post = >$(t) 2>&1 && $(check_test)
152
+ else
153
+ # we can't rely on -o pipefail outside of bash 3+,
154
+ # so we use a stamp file to indicate success and
155
+ # have rm fail if the stamp didn't get created
156
+ stamp = $@$(log_suffix).ok
157
+ quiet_pre = @echo $(RUBY) $(arg) $(TEST_OPTS); ! test -f $(stamp) && (
158
+ quiet_post = && > $(stamp) )2>&1 | tee $(t); \
159
+ rm $(stamp) 2>/dev/null && $(check_test)
160
+ endif
161
+
162
+ # not all systems have setsid(8), we need it because we spam signals
163
+ # stupidly in some tests...
164
+ rb_setsid := $(RUBY) -e 'Process.setsid' -e 'exec *ARGV'
165
+
166
+ # TRACER='strace -f -o $(t).strace -s 100000'
167
+ run_test = $(quiet_pre) \
168
+ $(rb_setsid) $(TRACER) $(RUBY) -w $(arg) $(TEST_OPTS) $(quiet_post) || \
169
+ (sed "s,^,$(extra): ," >&2 < $(t); exit 1)
170
+
171
+ %.n: arg = $(subst .n,,$(subst --, -n ,$@))
172
+ %.n: t = $(subst .n,$(log_suffix),$@)
173
+ %.n: export PATH := $(CURDIR)/$(tmp_bin):$(PATH)
174
+ %.n: export RUBYLIB := $(lib):$(RUBYLIB)
175
+ %.n: $(test_prereq)
176
+ $(run_test)
177
+
178
+ $(T): arg = $@
179
+ $(T): t = $(subst .rb,$(log_suffix),$@)
180
+ $(T): export PATH := $(CURDIR)/$(tmp_bin):$(PATH)
181
+ $(T): export RUBYLIB := $(lib):$(RUBYLIB)
182
+ $(T): $(test_prereq)
183
+ $(run_test)
184
+
185
+ install: $(bins) $(ext)/unicorn_http.c
186
+ $(prep_setup_rb)
187
+ $(RM) -r .install-tmp
188
+ mkdir .install-tmp
189
+ cp -p bin/* .install-tmp
190
+ $(RUBY) setup.rb all
191
+ $(RM) $^
192
+ mv .install-tmp/* bin/
193
+ $(RM) -r .install-tmp
194
+ $(prep_setup_rb)
195
+
196
+ setup_rb_files := .config InstalledFiles
197
+ prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
198
+
199
+ clean:
200
+ -$(MAKE) -C $(ext) clean
201
+ $(RM) $(ext)/Makefile
202
+ $(RM) $(setup_rb_files) $(t_log)
203
+ $(RM) -r $(ext_pfx) man t/trash
204
+ $(RM) $(html1)
205
+
206
+ man1 := $(addprefix Documentation/, unicorn.1 unicorn_rails.1)
207
+ html1 := $(addsuffix .html, $(man1))
208
+ man : $(man1) | man/man1
209
+ $(INSTALL) -m 644 $(man1) man/man1
210
+
211
+ html : $(html1) | doc/man1
212
+ $(INSTALL) -m 644 $(html1) doc/man1
213
+
214
+ %.1.html: %.1
215
+ $(OLDDOC) man2html -o $@ ./$<
216
+
217
+ pkg_extra := GIT-VERSION-FILE lib/unicorn/version.rb LATEST NEWS \
218
+ $(ext)/unicorn_http.c $(man1_paths)
219
+
220
+ NEWS:
221
+ $(OLDDOC) prepare
222
+
223
+ .manifest: $(ext)/unicorn_http.c man NEWS
224
+ (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
225
+ LC_ALL=C sort > $@+
226
+ cmp $@+ $@ || mv $@+ $@
227
+ $(RM) $@+
228
+
229
+ PLACEHOLDERS = $(man1_rdoc)
230
+ doc: .document $(ext)/unicorn_http.c man html .olddoc.yml $(PLACEHOLDERS)
231
+ find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';'
232
+ $(RM) -r doc
233
+ $(OLDDOC) prepare
234
+ $(RDOC) -f dark216
235
+ $(OLDDOC) merge
236
+ $(INSTALL) -m 644 COPYING doc/COPYING
237
+ $(INSTALL) -m 644 NEWS.atom.xml doc/NEWS.atom.xml
238
+ $(INSTALL) -m 644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
239
+ $(INSTALL) -m 644 $(man1_paths) doc/
240
+ tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
241
+
242
+ # publishes docs to https://yhbt.net/unicorn/
243
+ publish_doc:
244
+ -git set-file-times
245
+ $(MAKE) doc
246
+ $(MAKE) doc_gz
247
+ chmod 644 $$(find doc -type f)
248
+ $(RSYNC) -av doc/ yhbt.net:/srv/yhbt/unicorn/ \
249
+ --exclude index.html* --exclude created.rid*
250
+ git ls-files | xargs touch
251
+
252
+ # Create gzip variants of the same timestamp as the original so nginx
253
+ # "gzip_static on" can serve the gzipped versions directly.
254
+ doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.gz$$')
255
+ doc_gz:
256
+ for i in $(docs); do \
257
+ gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
258
+
259
+ ifneq ($(VERSION),)
260
+ rfpackage := unicorn
261
+ pkggem := pkg/$(rfpackage)-$(VERSION).gem
262
+ pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
263
+
264
+ # ensures we're actually on the tagged $(VERSION), only used for release
265
+ verify:
266
+ test x"$(shell umask)" = x0022
267
+ git rev-parse --verify refs/tags/v$(VERSION)^{}
268
+ git diff-index --quiet HEAD^0
269
+ test `git rev-parse --verify HEAD^0` = \
270
+ `git rev-parse --verify refs/tags/v$(VERSION)^{}`
271
+
272
+ fix-perms:
273
+ git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
274
+ git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
275
+
276
+ gem: $(pkggem)
277
+
278
+ install-gem: $(pkggem)
279
+ gem install --local $(CURDIR)/$<
280
+
281
+ $(pkggem): .manifest fix-perms | pkg
282
+ gem build $(rfpackage).gemspec
283
+ mv $(@F) $@
284
+
285
+ $(pkgtgz): distdir = $(basename $@)
286
+ $(pkgtgz): HEAD = v$(VERSION)
287
+ $(pkgtgz): .manifest fix-perms
288
+ @test -n "$(distdir)"
289
+ $(RM) -r $(distdir)
290
+ mkdir -p $(distdir)
291
+ tar cf - $$(cat .manifest) | (cd $(distdir) && tar xf -)
292
+ cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
293
+ mv $@+ $@
294
+
295
+ package: $(pkgtgz) $(pkggem)
296
+
297
+ release: verify package
298
+ # push gem to Gemcutter
299
+ gem push $(pkggem)
300
+ else
301
+ gem install-gem: GIT-VERSION-FILE
302
+ $(MAKE) $@ VERSION=$(GIT_VERSION)
303
+ endif
304
+
305
+ $(PLACEHOLDERS):
306
+ echo olddoc_placeholder > $@
307
+
308
+ check-warnings:
309
+ @(for i in $$(git ls-files '*.rb' bin | grep -v '^setup\.rb$$'); \
310
+ do $(RUBY) --disable-gems -d -W2 -c \
311
+ $$i; done) | grep -v '^Syntax OK$$' || :
312
+
313
+ .PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) man $(T_sh) clean
@@ -0,0 +1,112 @@
1
+ = Unicorn Hacker's Guide
2
+
3
+ == Polyglot Infrastructure
4
+
5
+ Like Mongrel, we use Ruby where it makes sense, and Ragel with C where
6
+ it helps performance. All of the code that actually runs your Rack
7
+ application is written Ruby, Ragel or C.
8
+
9
+ As far as tests and documentation goes, we're not afraid to embrace Unix
10
+ and use traditional Unix tools where they make sense and get the job
11
+ done.
12
+
13
+ === Tests
14
+
15
+ Tests are good, but slow tests make development slow, so we make tests
16
+ faster (in parallel) with GNU make (instead of Rake) and avoiding
17
+ RubyGems.
18
+
19
+ Users of GNU-based systems (such as GNU/Linux) usually have GNU make
20
+ installed as "make" instead of "gmake".
21
+
22
+ Running the entire test suite with 4 tests in parallel:
23
+
24
+ gmake -j4 check
25
+
26
+ Running just one unit test:
27
+
28
+ gmake test/unit/test_http_parser.rb
29
+
30
+ Running just one test case in a unit test:
31
+
32
+ gmake test/unit/test_http_parser.rb--test_parse_simple.n
33
+
34
+ === HttpServer
35
+
36
+ We strive to write as little code as possible while still maintaining
37
+ readability. However, readability and flexibility may be sacrificed for
38
+ performance in hot code paths. For Ruby, less code generally means
39
+ faster code.
40
+
41
+ Memory allocation should be minimized as much as practically possible.
42
+ Buffers for IO#readpartial are preallocated in the hot paths to avoid
43
+ building up garbage. Hash assignments use frozen strings to avoid the
44
+ duplication behind-the-scenes.
45
+
46
+ We spend as little time as possible inside signal handlers and instead
47
+ defer handling them for predictability and robustness. Most of the
48
+ Unix-specific things are in the Unicorn::HttpServer class. Unix systems
49
+ programming experience will come in handy (or be learned) here.
50
+
51
+ === Documentation
52
+
53
+ Please wrap documentation at 72 characters-per-line or less (long URLs
54
+ are exempt) so it is comfortably readable from terminals.
55
+
56
+ When referencing mailing list posts, use
57
+ <tt>https://yhbt.net/unicorn-public/$MESSAGE_ID/</tt> if possible
58
+ since the Message-ID remains searchable even if a particular site
59
+ becomes unavailable.
60
+
61
+ === Ruby/C Compatibility
62
+
63
+ We target C Ruby 2.0 and later. We need the Ruby
64
+ implementation to support fork, exec, pipe, UNIX signals, access to
65
+ integer file descriptors and ability to use unlinked files.
66
+
67
+ All of our C code is OS-independent and should run on compilers
68
+ supported by the versions of Ruby we target.
69
+
70
+ === Ragel Compatibility
71
+
72
+ We target the latest released version of Ragel and will update our code
73
+ to keep up with new releases. Packaged tarballs and gems include the
74
+ generated source code so they will remain usable if compatibility is
75
+ broken.
76
+
77
+ == Contributing
78
+
79
+ Contributions are welcome in the form of patches, pull requests, code
80
+ review, testing, documentation, user support or any other feedback is
81
+ welcome. The mailing list is the central coordination point for all
82
+ user and developer feedback and bug reports.
83
+
84
+ === Submitting Patches
85
+
86
+ Follow conventions already established in the code and do not exceed 80
87
+ characters per line.
88
+
89
+ Inline patches (from "git format-patch -M") to the mailing list are
90
+ preferred because they allow code review and comments in the reply to
91
+ the patch.
92
+
93
+ We will adhere to mostly the same conventions for patch submissions as
94
+ git itself. See the
95
+ {SubmittingPatches}[https://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches]
96
+ document
97
+ distributed with git on on patch submission guidelines to follow. Just
98
+ don't email the git mailing list or maintainer with Unicorn patches :)
99
+
100
+ == Building a Gem
101
+
102
+ You can build the Unicorn gem with the following command:
103
+
104
+ gmake gem
105
+
106
+ == Running Development Versions
107
+
108
+ It is easy to install the contents of your git working directory:
109
+
110
+ Via RubyGems
111
+
112
+ gmake install-gem
@@ -0,0 +1,97 @@
1
+ = Issues
2
+
3
+ mailto:unicorn-public@yhbt.net is the best place to report bugs,
4
+ submit patches and/or obtain support after you have searched the
5
+ {email archives}[https://yhbt.net/unicorn-public/] and
6
+ {documentation}[https://yhbt.net/unicorn/].
7
+
8
+ * No subscription will ever be required to email us
9
+ * Cc: all participants in a thread or commit, as subscription is optional
10
+ * Do not {top post}[http://catb.org/jargon/html/T/top-post.html] in replies
11
+ * Quote as little as possible of the message you're replying to
12
+ * Do not send HTML mail or images,
13
+ they hurt reader privacy and will be flagged as spam
14
+ * Anonymous and pseudonymous messages will ALWAYS be welcome
15
+ * The email submission port (587) is enabled on the yhbt.net MX:
16
+ https://yhbt.net/unicorn-public/20141004232241.GA23908@dcvr.yhbt.net/t/
17
+
18
+ We will never have a centralized or formal bug tracker. Instead we
19
+ can interoperate with any bug tracker which can Cc: us plain-text to
20
+ mailto:unicorn-public@yhbt.net This includes the Debian BTS
21
+ at https://bugs.debian.org/unicorn and possibly others.
22
+
23
+ unicorn is a server; it does not depend on graphics/audio. Nobody
24
+ communicating with us will ever be expected to go through the trouble
25
+ of setting up graphics nor audio support.
26
+
27
+ If your issue is of a sensitive nature or you're just shy in public,
28
+ use anonymity tools such as Tor or Mixmaster; and rely on the public
29
+ mail archives for responses. Be sure to scrub sensitive log messages
30
+ and such.
31
+
32
+ If you don't get a response within a few days, we may have forgotten
33
+ about it so feel free to ask again.
34
+
35
+ == Bugs in related projects
36
+
37
+ unicorn is sometimes affected by bugs in its dependencies. Bugs
38
+ triggered by unicorn in mainline Ruby, rack, GNU C library (glibc),
39
+ or the Linux kernel will be reported upstream and fixed.
40
+
41
+ For bugs in Ruby itself, we may forward bugs to
42
+ https://bugs.ruby-lang.org/ and discuss+fix them on the ruby-core
43
+ list at mailto:ruby-core@ruby-lang.org
44
+ Subscription to post is required to ruby-core, unfortunately:
45
+ mailto:ruby-core-request@ruby-lang.org?subject=subscribe
46
+ Unofficial archives are available at: https://public-inbox.org/ruby-core/
47
+
48
+ For uncommon bugs in Rack, we may forward bugs to
49
+ mailto:rack-devel@googlegroups.com and discuss there.
50
+ Subscription (without any web UI or Google account) is possible via:
51
+ mailto:rack-devel+subscribe@googlegroups.com
52
+ Note: not everyone can use the proprietary bug tracker used by Rack,
53
+ but their mailing list remains operational.
54
+ Unofficial archives are available at: https://public-inbox.org/rack-devel/
55
+
56
+ Uncommon bugs we encounter in the Linux kernel should be Cc:-ed to the
57
+ Linux kernel mailing list (LKML) at mailto:linux-kernel@vger.kernel.org
58
+ and subsystem maintainers such as mailto:netdev@vger.kernel.org
59
+ (for networking issues). It is expected practice to Cc: anybody
60
+ involved with any problematic commits (including those in the
61
+ Signed-off-by: and other trailer lines). No subscription is necessary,
62
+ and the our mailing list follows the same conventions as LKML for
63
+ interopability. Archives are available at https://lore.kernel.org/lkml/
64
+ There is a kernel.org Bugzilla instance, but it is ignored by most.
65
+
66
+ Likewise for any rare glibc bugs we might encounter, we should Cc:
67
+ mailto:libc-alpha@sourceware.org
68
+ Unofficial archives are available at: https://public-inbox.org/libc-alpha/
69
+ Keep in mind glibc upstream does use Bugzilla for tracking bugs:
70
+ https://sourceware.org/bugzilla/
71
+
72
+ == Submitting Patches
73
+
74
+ See the HACKING document (and additionally, the
75
+ {SubmittingPatches}[https://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches]
76
+ document distributed with git) on guidelines for patch submission.
77
+
78
+ == Contact Info
79
+
80
+ Mail is publicly-archived, SMTP subscription is discouraged to avoid
81
+ servers being a single-point-of-failure, so Cc: all participants.
82
+
83
+ The HTTP(S) archives have links to per-thread Atom feeds and downloadable
84
+ mboxes. Read-only IMAP(S) folders and NNTP(S) newsgroups are also available.
85
+
86
+ * https://yhbt.net/unicorn-public/
87
+ * http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/unicorn-public/
88
+ * imaps://yhbt.net/inbox.comp.lang.ruby.unicorn.0
89
+ * imap://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.unicorn.0
90
+ * nntps://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
91
+ * nntp://news.gmane.io/gmane.comp.lang.ruby.unicorn.general
92
+
93
+ Full Atom feeds:
94
+ * https://yhbt.net/unicorn-public/new.atom
95
+ * http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/unicorn-public/new.atom
96
+
97
+ We only accept plain-text mail: mailto:unicorn-public@yhbt.net
@@ -0,0 +1,79 @@
1
+ = Known Issues
2
+
3
+ Occasionally odd {issues}[link:ISSUES.html] arise without a transparent or
4
+ acceptable solution. Those issues are documented here.
5
+
6
+ * Some libraries/applications may install signal handlers which conflict
7
+ with signal handlers unicorn uses. Leaving "preload_app false"
8
+ (the default) will allow unicorn to always override existing signal
9
+ handlers.
10
+
11
+ * Issues with FreeBSD jails can be worked around as documented by Tatsuya Ono:
12
+ https://yhbt.net/unicorn-public/CAHBuKRj09FdxAgzsefJWotexw-7JYZGJMtgUp_dhjPz9VbKD6Q@mail.gmail.com/
13
+
14
+ * PRNGs (pseudo-random number generators) loaded before forking
15
+ (e.g. "preload_app true") may need to have their internal state
16
+ reset in the after_fork hook. Starting with unicorn 3.6.1, we
17
+ have builtin workarounds for Kernel#rand and OpenSSL::Random users,
18
+ but applications may use other PRNGs.
19
+
20
+ * For notes on sandboxing tools such as Bundler or Isolate,
21
+ see the {Sandbox}[link:Sandbox.html] page.
22
+
23
+ * nginx with "sendfile on" under FreeBSD 8 is broken when
24
+ uploads are buffered to disk. Disabling sendfile is required to
25
+ work around this bug which should be fixed in newer versions of FreeBSD.
26
+
27
+ * When using "preload_app true", with apps using background threads
28
+ need to restart them in the after_fork hook because threads are never
29
+ shared with child processes. Additionally, any synchronization
30
+ primitives (Mutexes, Monitors, ConditionVariables) should be
31
+ reinitialized in case they are held during fork time to avoid
32
+ deadlocks. The core Ruby Logger class needlessly uses a MonitorMutex
33
+ which can be disabled with a {monkey patch}[link:examples/logger_mp_safe.rb]
34
+
35
+ == Known Issues (Old)
36
+
37
+ * Under some versions of Ruby 1.8, it is necessary to call +srand+ in an
38
+ after_fork hook to get correct random number generation. We have a builtin
39
+ workaround for this starting with unicorn 3.6.1
40
+
41
+ See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/36450
42
+
43
+ * On Ruby 1.8 prior to Ruby 1.8.7-p248, *BSD platforms have a broken
44
+ stdio that causes failure for file uploads larger than 112K. Upgrade
45
+ your version of Ruby or continue using unicorn 1.x/3.4.x.
46
+
47
+ * Under Ruby 1.9.1, methods like Array#shuffle and Array#sample will
48
+ segfault if called after forking. Upgrade to Ruby 1.9.2 or call
49
+ "Kernel.rand" in your after_fork hook to reinitialize the random
50
+ number generator.
51
+
52
+ See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/28655
53
+
54
+ * Rails 2.3.2 bundles its own version of Rack. This may cause subtle
55
+ bugs when simultaneously loaded with the system-wide Rack Rubygem
56
+ which unicorn depends on. Upgrading to Rails 2.3.4 (or later) is
57
+ strongly recommended for all Rails 2.3.x users for this (and security
58
+ reasons). Rails 2.2.x series (or before) did not bundle Rack and are
59
+ should be unnaffected. If there is any reason which forces your
60
+ application to use Rails 2.3.2 and you have no other choice, then
61
+ you may edit your unicorn gemspec and remove the Rack dependency.
62
+
63
+ ref: https://yhbt.net/unicorn-public/20091014221552.GA30624@dcvr.yhbt.net/
64
+ Note: the workaround described in the article above only made
65
+ the issue more subtle and we didn't notice them immediately.
66
+
67
+ * WONTFIX: code reloading and restarts with Sinatra 0.3.x (and likely older
68
+ versions) apps is broken. The workaround is to force production
69
+ mode to disable code reloading as well as disabling "run" in your
70
+ Sinatra application:
71
+ set :env, :production
72
+ set :run, false
73
+ Since this is no longer an issue with Sinatra 0.9.x apps, this will not be
74
+ fixed on our end. Since unicorn is itself the application launcher, the
75
+ at_exit handler used in old Sinatra always caused Mongrel to be launched
76
+ whenever a unicorn worker was about to exit.
77
+
78
+ Also remember we're capable of replacing the running binary without dropping
79
+ any connections regardless of framework :)
@@ -0,0 +1,24 @@
1
+ === unicorn 6.0.0 - no more recycling Rack env / 2021-03-17 06:38 UTC
2
+
3
+ This release allocates a new Rack `env' hash for every request.
4
+ This is done for safety with internally-(thread|event)-using Rack
5
+ apps which expect to use `env' after the normal Rack response is
6
+ complete, but without relying on rack.hijack[1]. Thanks to
7
+ Dirkjan Bussink <d.bussink@gmail.com> for the patch:
8
+
9
+ https://yhbt.net/unicorn-public/66A68DD8-83EF-4C7A-80E8-3F1F7AB31670@github.com/
10
+
11
+ The major version is bumped since:
12
+
13
+ 1) there are performance regressions for some simple Rack apps
14
+
15
+ 2) unsupported 3rd-party monkey patches which previously
16
+ relied on this behavior may be broken (our version of
17
+ OobGC was).
18
+
19
+ The test suite is also more reliable on multi-core systems
20
+ and Ruby 3.x.
21
+
22
+ [1] thread from 2017 around rack.hijack safety:
23
+ https://yhbt.net/unicorn-public/CAAtdryPG3nLuyo0jxfYW1YHu1Q+ZpkLkd4KdWC8vA46B5haZxw@mail.gmail.com/
24
+
@@ -0,0 +1,67 @@
1
+ Unicorn is copyrighted free software by all contributors, see logs in
2
+ revision control for names and email addresses of all of them.
3
+
4
+ You can redistribute it and/or modify it under either the terms of the
5
+ GNU General Public License (GPL) as published by the Free Software
6
+ Foundation (FSF), either version 2 of the License, or (at your option)
7
+ any later version. We currently prefer the GPLv3 or later for
8
+ derivative works, but the GPLv2 is fine.
9
+
10
+ The complete texts of the GPLv2 and GPLv3 are below:
11
+ GPLv2 - https://www.gnu.org/licenses/gpl-2.0.txt
12
+ GPLv3 - https://www.gnu.org/licenses/gpl-3.0.txt
13
+
14
+ You may (against our _preference_) also use the Ruby 1.8 license terms
15
+ which we inherited from the original Mongrel project when we forked it:
16
+
17
+ === Ruby 1.8-specific terms (if you're not using the GPL)
18
+
19
+ 1. You may make and give away verbatim copies of the source form of the
20
+ software without restriction, provided that you duplicate all of the
21
+ original copyright notices and associated disclaimers.
22
+
23
+ 2. You may modify your copy of the software in any way, provided that
24
+ you do at least ONE of the following:
25
+
26
+ a) place your modifications in the Public Domain or otherwise make them
27
+ Freely Available, such as by posting said modifications to Usenet or an
28
+ equivalent medium, or by allowing the author to include your
29
+ modifications in the software.
30
+
31
+ b) use the modified software only within your corporation or
32
+ organization.
33
+
34
+ c) rename any non-standard executables so the names do not conflict with
35
+ standard executables, which must also be provided.
36
+
37
+ d) make other distribution arrangements with the author.
38
+
39
+ 3. You may distribute the software in object code or executable
40
+ form, provided that you do at least ONE of the following:
41
+
42
+ a) distribute the executables and library files of the software,
43
+ together with instructions (in the manual page or equivalent) on where
44
+ to get the original distribution.
45
+
46
+ b) accompany the distribution with the machine-readable source of the
47
+ software.
48
+
49
+ c) give non-standard executables non-standard names, with
50
+ instructions on where to get the original software distribution.
51
+
52
+ d) make other distribution arrangements with the author.
53
+
54
+ 4. You may modify and include the part of the software into any other
55
+ software (possibly commercial). But some files in the distribution
56
+ are not written by the author, so that they are not under this terms.
57
+
58
+ 5. The scripts and library files supplied as input to or produced as
59
+ output from the software do not automatically fall under the
60
+ copyright of the software, but belong to whomever generated them,
61
+ and may be sold commercially, and may be aggregated with this
62
+ software.
63
+
64
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
65
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
66
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
67
+ PURPOSE.