Date | Commit message (Collapse) |
|
Rack uses a single newline character to represent multi-value
headers. Thus { 'Set-Cookie' => "foo=bar\nbar=foo" }
will get you:
Set-Cookie: foo=bar
Set-Cookie: bar=foo
While RFC2616 says you can combine headers as:
Set-Cookie: foo=bar,bar=foo
There are probably HTTP clients out there that don't handle
things correctly so don't bother...
Additionally, don't bother doing duplicate suppression anymore.
Just assume Rack or a higher layer knows what it's doing
regarding duplicates and we'll get a Hash most of the time
anyways.
|
|
The master _may_ run with different user/group/umask than the
workers. Since the logs were always created by the master
process, the master should rotate them first to ensure correct
ownership and permissions.
This way if the workers fail log rotation and die, they'll
be automatically respawned with the new logs in place.
|
|
This test requires Rack to be loaded and will not
run without it. This also seems broken on 1.9 still
with Rack 0.9.1...
|
|
It's a CGI-ism and is not in the Rack spec, so don't bother.
|
|
Although I didn't like the idea initially, signal queueing
allows test_exec to run more reliably and the limited signal
queue size will prevent scary queued signal behavior.
Also, always wakeup the master immediately when CHLD is trapped
to reduce the performance impact of SIGHUP-based config
reloading. Combined with an extra check in test_exec, this
should make test_exec run much more reliably than before.
|
|
Despite reading numerous articles and inspecting the 1.9.1-p0 C
source, I will never trust that we're always handling
encoding-aware IO objects correctly. Thus this new test uses
UNIX shell utilities that should always operate on files/sockets
on a byte-level.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
|
|
Hopefully this increases test reliability
|
|
This reverts commit 4414d9bf34f162a604d2aacc765ab1ca2fc90404.
|
|
This reverts commit e66ab79b8b5bc5311c750bf03868a7b2574f4ea1.
Conflicts:
bin/unicorn
|
|
There used to be a log rotation lambda in there, but
that got moved to lib/unicorn/util.rb for convenience.
|
|
|
|
I consider it a sensible default for long-running servers.
Additionally, there is no easy way to make USR1 rotate the
master process log without this.
|
|
Since I use it myself and also in the tests, we
might as well implement it correctly as a class method
so people can run it in their trap('USR2') hooks.
|
|
Probably not a real bug, but test_exec has been experiencing
mysterious failures....
|
|
Oops, that was making debugging tests quite difficult.
|
|
It's confusing with the lowercase "-p" option which is more
common for developers to use. PID files are only needed for
production deployments, and those should be using config files
anyways.
|
|
Yeah, some of my test machines are ridiculously slow...
|
|
23x79 looks better in a terminal, but the Ruby 1.9
OptionParser output adds a little more whitespace
requiring 24x80 output, which is still fine...
|
|
Hopefully this fixes some random test failures I've
been experiencing...
|
|
Ensure the output fits in a standard ANSI terminal so it's easy
to read for all users regardless of what interface they're
working from.
|
|
Since not all rackup command-line options can be supported by
Unicorn, disable this gross hack to avoid potentially
unpredictable or undefined behavior. config.ru will not be able
to specify the config file for unicorn-specific options; but the
unicorn-specific config files themselves will be allowed to
override the default config.ru location.
|
|
|
|
This was accidentally left in there during 1.9
compatibility testing.
|
|
People can screw config files up, it's not my fault
if they do, but they do... Don't let the original
process get wedged if we can help it..
|
|
Apparently the at_exit handlers were not triggering for an
execed process.
|
|
Add a install-test for doing a mock install with private http11
and bin/unicorn and appropriate PATH/RUBYLIB env.
Also add a normal install target so we can just type
"make install" and just be done with a regular
installation (and it'll revert files if using git).
I use the following local.mk to augment my GNUmakefile. It
allows me to run "make -j full-test" and run both 1.8 and 1.9
tests in parallel.
--------------------------- 8< -------------------------
DLEXT := so
rack_ver := 0.9.1
ifeq ($(r19),)
ruby := $(HOME)/bin/ruby
RUBYLIB := $(HOME)/lib/ruby/gems/1.8/gems/rack-$(rack_ver)/lib
else
export PATH := $(HOME)/ruby-1.9/bin:$(PATH)
ruby := $(HOME)/ruby-1.9/bin/ruby
RUBYLIB := $(HOME)/ruby-1.9/lib/ruby/gems/1.9.1/gems/rack-$(rack_ver)/lib
endif
SHELL := /bin/bash -e -o pipefail
full-test: test-18 test-19
test-18:
$(MAKE) test 2>&1 | sed -u -e 's!^!1.8 !'
test-19:
$(MAKE) test r19=1 2>&1 | sed -u -e 's!^!1.9 !'
--------------------------- 8< -------------------------
|
|
This adds a bunch of execution tests that require the "unicorn"
binary to be in PATH as well as rack being directly
"require"-able ("rubygems" will not be loaded for you). The
tester is responsible for setting up PATH and RUBYLIB
appropriately.
|
|
We don't need these dependencies slowing down load times
on our tests..
|
|
Reset connections can also return EPIPE under Linux, not just
ECONNRESET; so be sure to trap that error, too.
|
|
Prevent the GC from trying to close it (and hitting the wrong
descriptor) when @random is reopened for running tests.
|
|
This also fixes a subtle bug in header generation when the +$,+
($OFS) variable is defined to something other than nil or ""
I'm really wondering what kind of drugs I was on (or _not_ on)
when I modified some of this from the Mongrel source.
|
|
Ruby 1.9 Tempfile objects can be passed directly to File.rename
(instead of the pathname). This doesn't work in 1.8, so always
just pass the pathname to File.rename.
|
|
Tempfile reuse was over-engineered and the problem was not
nearly as big a problem as initially thought.
Additionally, it could lead to a subtle bug in an applications
that link(2)s or rename(2)s the temporary file to a permanent
location _without_ closing it after the request is done.
Applications that suffer from the problem of directory bloat are
still free to modify ENV['TMPDIR'] to influence the creation of
Tempfiles.
|
|
unused_port is more reliable as it actually tries to bind
a port and retries if it fails. This is also safe across
parallel unicorn tests running in different directories.
|
|
Makes it much easier to track down failures if you know
something failed in the first place. A failed test early on
could be hidden because noise from successful tests drowned it
out.
|
|
We're not using them and they don't seem useful in any
shape or form...
|
|
While we'll support anything that exposes a Rack-like interface
(a very good one IMHO), we shouldn't have a hard dependency on
Rack to simplify testing.
While we're at it, I'm not using Daemons anymore, either,
since that does too many things behind our back as far as
daemonization goes.
As a result of not depending on Rubygems, either, I've sped
up my "make -j" test ~1.5 seconds
|
|
Just stuff what little logic we had for it into HttpResponse
since Rack takes care of the rest for us.
Put the HTTP_STATUS_HEADERS hash in HttpResponse since we're the
only user of it. Also, change HttpResponse.send to
HttpResponse.write to avoid overriding the default method.
|
|
Use select(2) to multiplex non-blocking accept(2) calls between
them. Additionally, aggressively make a bet after accepting
clients where we'll try to do a non-blocking accept(2) against
the full set of descriptors. This is based on the assumption
that if we just accepted connections, we're probably reasonably
busy.
This should lead to lower latency under high load; but some
wasted cycles when requests come in intermitently. By this same
logic, we don't really care for the thundering herd problem,
either; since it is only noticeable with many (hundreds) of
processes when most of them are idle.
|
|
The previous API was very flexible, but I don't think many
people really cared for it... We now repeatedly use the
same HeaderOut in each process since I completely don't
care for multithreading.
|
|
All tests for threading and semaphores have been removed. One
test was changed because it depended on a shared variable.
Tests will be replaced with tests to do process management
instead.
|
|
Avoid conflicting with existing Mongrel libraries since
we'll be incompatible and break things w/o disrupting
Mongrel installations.
|
|
Some of the tests here are horrifically slow due to sleeps,
allow using gmake to run these tests in parallel. My Core2 Duo
runs "make -j" over 10s faster than "rake".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|