about summary refs log tree commit homepage
DateCommit message (Collapse)
2009-04-21Remove @start_ctx instance variable
It's pointless to support multiple instances of it since this is per-process. However, the constant itself is now modifiable if anybody needs to tweak things for reexecution using a before_exec hook.
2009-04-21rename socket.rb => socket_helper.rb
We no longer have anything outside of SocketHelper module in that file, so just give it a more obvious name.
2009-04-21Stop extending core classes
This removes the #unicorn_peeraddr methods from TCPSocket and UNIXSocket core classes. Instead, just move that logic into the only place it needs to be used in HttpRequest.
2009-04-21http_response: small speedup by eliminating loop
This avoids creating yet another binding. socket.syswrite() should really only be called once since we use blocking sockets, but just in case, we emulate a do+while loop with begin+while
2009-04-21http11: rfc2616 handling of absolute URIs
We now parse the scheme, host and port from Absolute URIs and ignore them if the equivalents are specified in the other headers.
2009-04-21http11: cleanup some CPP macros
Use the "do {} while (0)" idiom to wrap the macros we can wrap to avoid having to worry about semi-colons when using them. Unfortunately DEF_MAX_LENGTH can't be wrapped with "do {} while (0)". But we do now correctly constify the strings DEF_MAX_LENGTH creates and also make them static to reduce visibility.
2009-04-21http11: make parser obey HTTP_HOST with empty port
This means "Host: foo-bar:" (trailing colon) will assume server_port is 80, not a blank string.
2009-04-21http11: minor cleanups in return types
While we're at it, replace a bunch of zero assignments with a memset to avoid forgetting a struct element in case we change the struct.
2009-04-21replace DATA_GET macro with a function
I don't see the point of using a macro here as it's never called in a hot path. It's a very minor size reduction in the binary, but also makes the rest of the code less noisy/screamy.
2009-04-21http11: remove callbacks from structure
There's no point in having redefinable callbacks if they're always going to be pointed to the same function. This reduces the size of the http_parser structure to half its original size. This change may actually make more sense in servers Mongrel/Thin than Unicorn since Unicorn only has one parser per-process while other servers can have hundreds or even thousands.
2009-04-21http11: formatting cleanups
2009-04-21const: remove unused QUERY_STRING constant
2009-04-21GNUmakefile: mark test_signals as a slow test
It's fast under 1.8, but 1.9 performance is really terrible, so run the tests in parallel.
2009-04-21HttpParser: set QUERY_STRING for Rack-compliance
2009-04-21http_request: freeze modifiable elements
Otherwise applications can change them behind our back and affect subsequent requests.
2009-04-21http11: remove unused variables/elements
We don't do anything special with content length in the parser other than forcing the headers without the "HTTP_" prefix for Rack-compliance.
2009-04-21Move absolute URI parsing into HTTP parser
It's part of the HTTP/1.1 (rfc2616), so we might as well handle it in there and set PATH_INFO while we're at it. Also, make "OPTIONS *" test not fail Rack::Lint
2009-04-21GNUmakefile: kill trailing whitespace after ragel
I have a nice hook in git that complains when trailing whitespace is present.
2009-04-21GNUmakefile: Fix ragel dependencies
2009-04-21http11: cleanup #includes and whitespace
Remove ctype.h and stdio.h #includes. We avoid ctype.h functions since it is locale-dependent and HTTP itself is locale-independent. Also, regenerate http11_parser.c against Ragel 6.4
2009-04-16test_upload: ensure StringIO objects are binary
Sockets always return binary encoded data, so when StringIO.new(string) is called, that StringIO object inherits the encoding of the initial string it was created with. And yes, Ruby 1.9 still makes me seriously uncomfortable with I/O manipulation since the encoding layer does things behind my back. UNIX is (and should always be) just a bag of bytes! Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-04-16unicorn 0.5.3 v0.5.3
2009-04-16Small garbage reduction in HttpResponse
Avoid creating new string objects and then discarding them right away by stuffing non-constant but always-present headers into the initial output.
2009-04-16remove DATE constant
We never use it anywhere explicitly for hash lookups
2009-04-16fix 100% CPU usage when idle
Oops, that was not just speculative accept(), but spammy accept()...
2009-04-16Fix my local.mk file to always run Rails tests
Help me ensure we never forget to run tests again.
2009-04-16Fix forgotten Rails tests
This was broken in 66841a0164bc03eddb7a6ac31e3923302dbc5146: ensure responses always have the "Status:" header
2009-04-16update Manifest (add test_signals.rb)
2009-04-16unicorn 0.5.2 v0.5.2
2009-04-16unicorn/const: kill trailing whitespace
Trailing whitespace glows *RED* every time I open this file to edit a constant and that annoys me.
2009-04-16GNUmakefile: small dependency cleanups
2009-04-16test: fix dependency issue with "make test-unit"
The $(test_prefix)/.stamp file must be a dependency of the parent make process otherwise the slow %.n children won't be able to communicate the dependency up to the other non-slow tests.
2009-04-16ensure responses always have the "Status:" header
There are weird (and possibly broken) clients out there that require it despite being present in the first line of the response. So be nice and accomodate them. Keep in mind that the Rack SPEC explicitly forbids this header from being in the headers returned by the Rack-based application; so we have to always inject it ourselves and ignore it if the application sets it.
2009-04-15http11: default server port is 443 for https
Also, some minor cleanups and branch refactoring.
2009-04-15worker_loop cleanups, var golf, and yak-shaving
Ensure we always fchmod our tempfile in case of client error to avoid getting nuked in the next request cycle. Also, kill off some unnecessary variables since this method has too many variables anyways and we can overload the "nr" counter to do what "accepted" and "reopen_logs" did..
2009-04-15before_commit and before_exec can never be nil/false
So don't bother checking them again. Configurator already ensures that they're Proc objects for us, and we've been forgetting to check @before_fork since the beginning of time anyways... Consistency + less code = good
2009-04-14s/rotating/reopening/g in log messages
We don't (and won't ever) do log rotation within the process. That's the job of logrotate and tools like that. We just reopen logs like other reasonable daemons out there.
2009-04-14Explicitly trap SIGINT/SIGTERM again
Otherwise we get generally worthless backtraces and we don't want to clobber those for other signals, either.
2009-04-13unicorn 0.5.1 v0.5.1
2009-04-13Fix SIGINT/SIGTERM handling (broken in 0.5.0)
By reraising SignalException in workers. Since we just rely on default signal handlers for the majority of signals now, ensure those signals actually exit the process.
2009-04-13unicorn 0.5.0 v0.5.0
2009-04-13Configurator: add example for user/group switching
I don't advocate running Unicorn on unprivileged ports anyways since Unicorn should never be exposed directly to public clients.
2009-04-13Expose worker to {before,after}_fork hooks
Instead of just worker.nr. This is a configuration file/API change and will break existing configurations. This allows worker.tempfile to be exposed to the hooks so ownership changes can still happen on it. On the other hand, I don't know of many people actually using this feature (or Unicorn).
2009-04-13Remove unnecessary local variables in process_client
I'm golfing, really, but maybe we can be 0.00001% faster if we avoid naming some variables...
2009-04-13small cleanups in signal handling and worker init
Since signals and signal handlers are process-wide, just make SIG_QUEUE a global constant since there's absolutely no reason it should be otherwise... Restore default signal handlers when building app in case our app does anything strange or gets hung, it's nice to know SIG{INT,TERM} can be used to kill it while it's loading. Additionally, there's little point in clearing arrays before nilling them: just trust the GC to do its job properly.
2009-04-12old_rails: try harder to ensure valid responses
Hopefully the world will just move to Rack faster so we have less things to worry about.
2009-04-12Don't bother restoring ENV or umask across reexec
If someone changes ENV or umask in the master process (via before_fork or when loading the config), assume it was intentional and just preserve it across reexec.
2009-04-12Remove unnecessary sync assignment
We never write to the file anyways, and fchmod is never buffered
2009-04-12Save one fcntl() syscall on every request
MRI 1.8 always sets O_NONBLOCK on sockets to implement green threads correctly in the face of slow network I/O. Since we already know what the I/O flags for a client socket should be, we just set it to that instead. Applications running on Unicorn continue to be green thread-safe when used fast local traffic. Of course, Unicorn itself will never use threads.
2009-04-12test_http_parser: fix broken URL in comment
This was back when I did s/mongrel/Unicorn/g on the sources.