Date | Commit message (Collapse) |
|
While we're at it, avoid mixing declarations and code
in case there's still compiler compatibility problems.
(We will add a check for -Wdeclaration-after-statement support
in a separate commit)
|
|
Rack (since v2) has started explicitly listing the second (optional) argument for respond_to?, which matches the underlying Ruby spec. This patch fixes the calls in both C and Ruby approaches.
However, rb_respond_to only accepts a single argument - differing from the Ruby side of things - so perhaps this patch isn't quite perfect (and my C skills are very limited, so the whole thing could use a review).
|
|
Using rb_global_variable excessively can be expensive since it
uses a singly-linked list to track addresses. Since these
strings are all frozen and constant, put them into an array
instead and only mark the array as a global to improve locality.
Ruby 1.9+ has rb_gc_register_mark_object but it is
not part of the documented, public API, so we're not
using it, yet.
|
|
If I (the person who wrote this) spent a minute figuring out why
it wasn't needed, somebody else might, too. Save someone else
a minute.
|
|
These defines may cause incompatibilities if Ruby or other
system headers decide to clobber these. It's also confusing to
override existing, well-known-and-standardized functions.
|
|
|
|
:to_io never was a Rack extension, and ends up breaking the case
where an SSL socket is proxied. The role of :to_io in IO-like
objects is to aid IO.select and like methods.
|
|
rb_thread_blocking_region is deprecated and will be removed
|
|
|
|
If we convert an object to string, there is a potential the
compiler may optimize away the converted string if escaping
is needed. Prevent that with RB_GC_GUARD.
|
|
RB_GC_GUARD is more explicit in intent.
|
|
We do not need it anymore
|
|
The fstat syscall should never take long, even on sockets and
slow FSes.
|
|
I have not benchmarked this, but this is unlikely to be a bottleneck
at all in older Rubies. It results in a smaller binary, too, which
will help with icache bloat. This should also improve performance
under Rubinius, too.
|
|
Ruby 2.0.0preview1 is out, and we happen to be compatible
(with some harmless linker/build warnings)
|
|
Rack::Lint::ErrorWrapper forbids the "<<" method. This
fallback only comes into play when no log destination
(via :logger or :path) is specified and is rarely an
issue in real setups.
|
|
These values are untrusted, so if any client sends them to us
we must escape them.
|
|
This matches the behavior of nginx 1.0.9
|
|
Nothing wrong with the GVL in Ruby 1.9.3; but we'll need
to modify our code if it's removed for C extensions.
|
|
Some Ruby installs muck up headers/#defines and cause weirdness.
We now explicitly define _BSD_SOURCE and include #stdio.h
|
|
This doesn't apply to people that use strftime()-formats,
but that's a minority.
|
|
This appeared in nginx 0.9.6
|
|
Braindamage from back in the day when I didn't understand mkmf
|
|
Oops
|
|
Unlikely, but it may make a difference somewhere...
|
|
While local filesystems are usually very fast, we are
pessimistic and should prepare for worst-case scenarios. This
can use rb_thread_io_blocking_region() under Ruby 1.9.3dev.
|
|
Unlikely, but some app could pass '\0' into us
|
|
Rubinius may be pickier about what a VALUE is, so we can't
safely cast any C address into VALUEs.
|
|
Since we delegated response_to?, we also need to delegate
method_missing to the response body in case there are
non-standard methods defined outside of Rack.
|
|
This optimization is used by Rainbows! to pass IO objects
to the response body.
|
|
In case some folks need to use insanely long time formats,
we'll support them.
|
|
call-seq is needed to make C functions look good
|
|
The Clogger::ToPath proxy struct class is gone and
so is our need to access it.
|
|
We can just make Clogger#respond_to? smarter and forward
everything except :close to the body we're proxying.
|
|
Fix a reversed typedef and also deal with the case where
CLOCK_MONOTONIC is a function call and not a constant
macro.
|
|
This should also detect cases where CLOCK_MONOTONIC is
available at build but not at runtime.
|
|
clock_gettime() is not available on some systems and/or
CLOCK_MONOTONIC. This is totally broken considering the
POSIX standard was 10 years ago, now.
Nothing in gnulib, either, wtf?!
http://www.gnu.org/software/gnulib/manual/html_node/clock_005fgettime.html
|
|
|
|
RSTRUCT_PTR access is unlikely to ever happen for Rubinius,
so we'll just make a method dispatch and leave the faster
code for Ruby 1.8 and 1.9.
|
|
ruby.h doesn't seem to like being included after time.h
|
|
This lets us use CLOCK_MONOTONIC so we are not affected by
system clock changes.
We still convert to microseconds instead of nanoseconds for
(pure)-Ruby 1.8 code compatibility. There is also little need
for nanosecond timer resolution in log files (microsecond is not
needed, even).
|
|
This lessens confusion for people configuring Clogger in
config.ru, since "File" could be mistaken for Rack::File
and "::File" needs to be specified.
|
|
|
|
There's no way in hell a valid file descriptor can have
a negative number attached to it.
|
|
Sometimes programmers can blindly set O_NONBLOCK on everything
in sight. However, O_NONBLOCK has no effect on regular files,
so ignore it and allow the raw file descriptor to be used.
|
|
|
|
Certain configurations of Rainbows! (and Zbatery) are able to
use the return value of body.to_path to serve static files
more efficiently.
This also allows middleware like Rack::Contrib::Sendfile to
work properly higher up the stack, too.
|
|
We no longer write the log out at the end of the body.each call.
This is a behavioral change, but fortunately all Rack servers
I've seen call body.close inside an ensure.
This allows us to later pass along the "to_path" method
and not rely on "each" to write the log.
|
|
default CFLAGS for 1.9.2dev complains
|
|
|