about summary refs log tree commit homepage
path: root/ext
DateCommit message (Collapse)
2017-05-21SQUASH/WIP - use rb_funcallv to handle second respond_to arg respond_to-priv
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)
2017-05-21Update respond_to? calls for second argument.
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).
2017-02-15ext: reduce frozen string marking overhead
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.
2017-01-17clogger.c: comment to explain the lack of GC guard
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.
2016-07-28ext: avoid clobbering existing system functions
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.
2015-01-13ext: get rid of noisy and unnecessary cast
2014-05-12remove :to_io support
: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.
2014-02-15use rb_thread_call_without_gvl for Ruby 2+
rb_thread_blocking_region is deprecated and will be removed
2014-02-15remove each_id, it was never used
2014-02-15prevent potential premature GC in byte_xs
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.
2014-02-15use RB_GC_GUARD instead of volatile
RB_GC_GUARD is more explicit in intent.
2014-02-15remove unused RARRAY_PTR macro
We do not need it anymore
2014-02-15blocking_helpers: remove fstat wrapper
The fstat syscall should never take long, even on sockets and slow FSes.
2013-09-26ext: avoid RARRAY_PTR usage for RGenGC in Ruby 2.1.0
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.
2012-11-06ext: enable C extension under Ruby 2.0.0
Ruby 2.0.0preview1 is out, and we happen to be compatible (with some harmless linker/build warnings)
2012-11-02avoid calling "<<" on env["rack.errors"]
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.
2011-12-05escape individual cookie values from $cookie_*
These values are untrusted, so if any client sends them to us we must escape them.
2011-12-05escape bytes in the 0x7F-0xFF range, too
This matches the behavior of nginx 1.0.9
2011-07-20ext: note we rely on GVL for reentrancy detection
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.
2011-06-22ext: fix portability defines for some installs
Some Ruby installs muck up headers/#defines and cause weirdness. We now explicitly define _BSD_SOURCE and include #stdio.h
2011-04-19$time_local and $time_utc are locale-independent
This doesn't apply to people that use strftime()-formats, but that's a minority.
2011-04-16add support for $time_iso8601 format
This appeared in nginx 0.9.6
2011-03-21extconf: unnecessary dir_config statement
Braindamage from back in the day when I didn't understand mkmf
2011-03-16fix documentation of Clogger.new for :path
Oops
2011-03-13avoid potential RString -> C-string conversions
Unlikely, but it may make a difference somewhere...
2011-03-13release GVL for filesystem operations
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.
2011-03-13ext: ensure path is a valid C string
Unlikely, but some app could pass '\0' into us
2011-03-04ext: avoid potentially unsafe casts with C API
Rubinius may be pickier about what a VALUE is, so we can't safely cast any C address into VALUEs.
2011-01-21delegate method_missing calls to the response body
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.
2011-01-21pass along "to_io" calls to the body
This optimization is used by Rainbows! to pass IO objects to the response body.
2011-01-14handle abitrarily long time formats in C extension
In case some folks need to use insanely long time formats, we'll support them.
2011-01-14RDoc fixups
call-seq is needed to make C functions look good
2011-01-14remove dead RSTRUCT* compatibility macros
The Clogger::ToPath proxy struct class is gone and so is our need to access it.
2011-01-14remove Clogger::ToPath proxy class
We can just make Clogger#respond_to? smarter and forward everything except :close to the body we're proxying.
2011-01-14another try to fix systems without CLOCK_MONOTONIC
Fix a reversed typedef and also deal with the case where CLOCK_MONOTONIC is a function call and not a constant macro.
2011-01-14another workaround for systems with broken CLOCK_MONOTONIC
This should also detect cases where CLOCK_MONOTONIC is available at build but not at runtime.
2011-01-12attempt to support broken/crazy systems
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
2011-01-12remove unused function (obj_fileno)
2010-12-25add support for Rubinius
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.
2010-12-24fix #include ordering under FreeBSD 7.2
ruby.h doesn't seem to like being included after time.h
2010-12-24use clock_gettime for time resolution
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).
2010-12-24accept a new :path argument in initialize
This lessens confusion for people configuring Clogger in config.ru, since "File" could be mistaken for Rack::File and "::File" needs to be specified.
2010-06-06ext: comment why we do what we do in to_path
2010-06-06ext: the N in /dev/fd/N must be unsigned
There's no way in hell a valid file descriptor can have a negative number attached to it.
2010-06-06ext: handle weird regular files with O_NONBLOCK set
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.
2010-06-06ext: cleanup -Wshadow warning
2010-06-06pass-through body.to_path when wrapping the body
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.
2010-06-06when wrapping the body, body.close writes the log
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.
2010-04-21ext: avoid void pointer arithmetic
default CFLAGS for 1.9.2dev complains
2010-04-21ext: sparse cleanups