Date | Commit message (Collapse) |
|
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
|
|
|
|
These were (fortunately) harmless, but better safe than
sorry.
|
|
|
|
The return value of rb_inspect() may not be visible
on the stack without assigning it to a local variable
first.
|
|
This quiets down warnings when used with RubyGems loaders such
as Isolate and Bundler where the HTTP server already loaded
Rack.
|
|
some people subclass HeaderHash and want them preserved
through the middleware stack.
|
|
They're slightly faster when we know a number is small enough
to be a FIXNUM.
|
|
The optional C extension leaked memory due to improper use of
the Ruby API, causing duplicated objects to never be garbage
collected.
I misread the Data_Make_Struct/Data_Wrap_Struct documentation
and ended up passing NULL as the "free" argument instead of -1,
causing the memory to never be freed.
From README.EXT in the MRI source which I misread:
> The free argument is the function to free the pointer
> allocation. If this is -1, the pointer will be just freed.
> The functions mark and free will be called from garbage
> collector.
|
|
Clogger may set this value independently of "rack.multithread"
since Actor/Fiber-based servers may have multiple instances of
Clogger wrapping different response bodies and yet be
incompatible with "rack.multithread"
|
|
It's too crazy to have to special case for frozen response
constants. 3-element arrays are cheap under Ruby 1.9 anyways.
|
|
Rack will be relaxing the spec to allow subclasses
of String objects. Just in case they're not compatible,
we'll convert them to strings.
|
|
This is to remain compatible with Rack if it relaxes
Rack::Lint to allow subclasses.
|
|
Since the wrapped Clogger object always responds to
close, we cannot blindly delegate the close method to
the body without ensuring it can be closed. So ensure
that it can be closed before attempting to close it,
all return values and errors are trapped and returned.
Reported-by: IƱaki Baz Castillo
|
|
|