Date | Commit message (Collapse) |
|
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.
|
|
We no longer have anything outside of SocketHelper module in
that file, so just give it a more obvious name.
|
|
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.
|
|
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
|
|
We now parse the scheme, host and port from Absolute URIs and
ignore them if the equivalents are specified in the other
headers.
|
|
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.
|
|
This means "Host: foo-bar:" (trailing colon) will assume
server_port is 80, not a blank string.
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
|
|
It's fast under 1.8, but 1.9 performance is really
terrible, so run the tests in parallel.
|
|
|
|
Otherwise applications can change them behind our back
and affect subsequent requests.
|
|
We don't do anything special with content length in the parser
other than forcing the headers without the "HTTP_" prefix for
Rack-compliance.
|
|
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
|
|
I have a nice hook in git that complains when trailing
whitespace is present.
|
|
|
|
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
|
|
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>
|
|
|
|
Avoid creating new string objects and then discarding them right
away by stuffing non-constant but always-present headers into
the initial output.
|
|
We never use it anywhere explicitly for hash lookups
|
|
Oops, that was not just speculative accept(), but
spammy accept()...
|
|
Help me ensure we never forget to run tests again.
|
|
This was broken in 66841a0164bc03eddb7a6ac31e3923302dbc5146:
ensure responses always have the "Status:" header
|
|
|
|
|
|
Trailing whitespace glows *RED* every time I open
this file to edit a constant and that annoys me.
|
|
|
|
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.
|
|
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.
|
|
Also, some minor cleanups and branch refactoring.
|
|
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..
|
|
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
|
|
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.
|
|
Otherwise we get generally worthless backtraces and we don't
want to clobber those for other signals, either.
|
|
|
|
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.
|
|
|
|
I don't advocate running Unicorn on unprivileged ports anyways
since Unicorn should never be exposed directly to public
clients.
|
|
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).
|
|
I'm golfing, really, but maybe we can be 0.00001% faster
if we avoid naming some variables...
|
|
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.
|
|
Hopefully the world will just move to Rack faster
so we have less things to worry about.
|
|
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.
|
|
We never write to the file anyways, and fchmod is never buffered
|
|
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.
|
|
This was back when I did s/mongrel/Unicorn/g
on the sources.
|