about summary refs log tree commit homepage
path: root/lib/unicorn/http_request.rb
DateCommit message (Collapse)
2009-03-10HttpRequest: update comment regarding short writes v0.1.0
Or lack thereof on POSIX.
2009-03-10HttpRequest: set binmode on tempfiles
Just in case this stupid Ruby 1.9-ism creeps up on someone; I haven't been able to reproduce I/O corruption from the test cases, but better safe than sorry here.
2009-03-03Allow stderr_path and stdout_path to be set in the config
As opposed to doing this in the shell, this allows the files to be reopened reliably after rotation. While we're at it, use $stderr/$stdout instead of STDERR/STDOUT since they seem to be more favored.
2009-02-25rename http11 => unicorn/http11
Avoid conflicting with existing (and future) Mongrel installs in case either changes. Of course, this also allows us more freedom to experiment and break the API if needed... However, I'm only planning on making minor changes to remove the amount of C code we have to maintain and possibly some minor performance improvements.
2009-02-13Remove tempfile reuse from HttpRequest, upload tests
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.
2009-02-09Refactor and get exec + FD inheritance working
Along with worker process management. This is nginx-style inplace upgrading (I don't know of another web server that does this). Basically we can preserve our opened listen sockets across entire executable upgrades. Signals: USR2 - Sending USR2 to the master unicorn process will cause it to exec a new master and keep the original workers running. This is useful to validate that the new code changes took place are valid and don't immediately die. Once the changes are validated (manually), you may send QUIT to the original master process to have it gracefully exit. HUP - Sending this to the master will make it immediately exec a new binary and cause the old workers to gracefully exit. Use this if you're certain the latest changes to Unicorn (and your app) are ready and don't need validating. Unlike nginx, re-execing a new binary will pick up any and all configuration changes. However listener sockets cannot be removed when exec-ing; only added (for now). I apologize for making such a big change in one commit, but once I got the ability to replace the entire codebase while preserving connections, it was too tempting to continue working. So I wrote a large chunk of this while hitting the unicorn-hello-world app with the following loop: while curl -vSsfN http://0:8080; do date +%N; done _Zero_ requests lost across multiple restarts.
2009-02-09HttpRequest: restart read(2) on EINTR
Since we handle signals, read(2) syscalls can fail on sockets with EINTR. Restart the call if we hit this.
2009-02-09Refactor HTTP Request processing into HttpRequest
Keeping I/O out of unicorn.rb
2009-02-09Skip EINTR/EAGAIN handling with syswrite
I'll be removing signal handling from worker processes...
2009-02-09Use a persistent buffer with HttpRequest
This allows us to avoid the overhead of allocating a new buffer each and every time we call sysread (even when just parsing headers for GET requests).
2009-02-09HttpRequest#reset! => HttpRequest#reset
Keep this somewhat consistent with the HttpParser API which also exposes #reset instead of #reset!
2009-02-09Make HttpRequest object (and temp files) persistent
This will help prevent TMPDIR from becoming bloated when handling thousands of large uploads a day. This is a problem in many UNIX filesystems (including ext3): names of entries never expire even after files are gone and the only way to clear it is to get rid of the directory itself.
2009-02-09Don't set SCRIPT_NAME to "/" and then clear it for Rack
It's pointless...
2009-02-09HttpRequest: avoid repeated hash lookups for HTTP_BODY
read_body can be a long-running loop; so avoid wasting CPU cycles by repeatedly performing a hash lookup to get to a temporary buffer.
2009-02-09Remove threading and use worker processes instead
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.
2009-02-09s/Mongrel/Unicorn/g
Avoid conflicting with existing Mongrel libraries since we'll be incompatible and break things w/o disrupting Mongrel installations.