# Unicorn 0.94.0 - small fixes and new features

**URL:** <https://www.ruby-forum.com/t/unicorn-0-94-0-small-fixes-and-new-features/178489>\
**Category:** Ruby\
**Created:** [November 5, 2009, 11:07am UTC](https://www.ruby-forum.com/t/unicorn-0-94-0-small-fixes-and-new-features/178489 "2009-11-05T11:07:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/97f17d/32.png) [@ericw](https://www.ruby-forum.com/u/ericw)\
**Post date:** [November 5, 2009, 11:07am UTC](https://www.ruby-forum.com/t/unicorn-0-94-0-small-fixes-and-new-features/178489/1 "2009-11-05T11:07:51Z")

</div>

Unicorn is a HTTP server for Rack applications designed to only serve  
fast clients on low-latency, high-bandwidth connections and take  
advantage of features in Unix/Unix-like kernels. Slow clients should  
only be served by placing a reverse proxy capable of fully buffering  
both the the request and response in between Unicorn and slow clients.

- [http://unicorn.bogomips.org/](http://unicorn.bogomips.org/)
- removed\_email\_address@domain.invalid
- git://git.bogomips.org/unicorn.git

Changes:

The HTTP parser is fix for oddly-aligned reads of trailers (this  
technically affects headers, too, but is highly unlikely due to  
our non-support of slow clients). This allows our HTTP parser  
to better support very slow clients when used by other servers  
(like Rainbows!). Fortunately this bug does not appear to lead  
to any invalid memory accesses (and potential arbitrary code  
execution).

FreeBSD (and possibly other \*BSDs) support is improved and and  
all the test cases pass under FreeBSD 7.2. Various flavors of  
GNU/Linux remains our primary platform for development and  
production.

New features added include the “working\_directory” directive in  
the configurator . Even without specifying a  
“working\_directory”, symlink-aware detection of the current path  
no longer depends on /bin/sh so it should work out-of-the-box on  
FreeBSD and Solaris and not just systems where /bin/sh is dash,  
ksh93 or bash.

User-switching support is finally supported but only intended  
for use in the after\_fork hook of worker processes. Putting it  
in the after\_fork hook allows allows users to set things like  
CPU affinity[1] on a per-worker basis before dropping  
privileges. The master process retains all privileges it  
started with.

The ENV[“RACK\_ENV”] (process-wide) environment variable is now  
both read and set for `unicorn' in the same way RAILS_ENV is used by `unicorn\_rails’. This allows the Merb launcher to read  
ENV[“RACK\_ENV”] in [config.ru](http://config.ru). Other web servers already set  
this and there may be applications or libraries that already  
rely on this de facto standard.

Eric W. (26):  
cleanup: avoid redundant error checks for fstat  
test\_helper: connect(2) may fail with EINVAL  
GNUmakefile: fix non-portable tar(1) usage  
tests: provide a pure Ruby setsid(8) equivalent  
more portable symlink awareness for START\_CTX[:cwd]  
test\_signals: avoid portability issues with fchmod(2)  
cleanup error handling and make it less noisy  
Do not override Dir.chdir in config files  
configurator: add “working\_directory” directive  
configurator: working\_directory is expanded  
configurator: set ENV[“PWD”] with working\_directory, too  
configurator: working\_directory affects pid, std{err,out}\_paths  
configurator: update documentation for working\_directory  
TODO: remove working\_directory bit, done  
Util.reopen\_logs: remove needless Range  
worker: user/group switching for after\_fork hooks  
Fix autoload of Etc in Worker for Ruby 1.9  
bin/unicorn: allow RACK\_ENV to be passed from parent  
tests for RACK\_ENV preservation  
http: allow headers/trailers to be written byte-wise  
http: extra test for bytewise chunked bodies  
tee\_input: do not clobber trailer buffer on partial uploads  
test\_exec: ensure master is killed after test  
Util::tmpio returns a TmpIO that responds to #size  
TODO: remove user-switching bit, done  
unicorn 0.94.0

Wayne L. (1):  
bin/unicorn: set ENV[“RACK\_ENV”] on startup

[1] - Unicorn does not support CPU affinity directly, but it is  
possible to load code that allows it inside after\_fork hooks,  
or even just call sched\_tool(8).
