about summary refs log tree commit homepage
path: root/ext
DateCommit message (Collapse)
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
2010-04-21ext: fix signedness and shadow warnings
These were (fortunately) harmless, but better safe than sorry.
2010-04-21ext: eliminate unused variable
2010-04-21ext: GC safety fix when throwing an exception
The return value of rb_inspect() may not be visible on the stack without assigning it to a local variable first.
2010-04-21avoid direct require of "rack" to quiet warnings
This quiets down warnings when used with RubyGems loaders such as Isolate and Bundler where the HTTP server already loaded Rack.
2010-04-08ext: preserve subclasses of Rack::Utils::HeaderHash
some people subclass HeaderHash and want them preserved through the middleware stack.
2010-04-08ext: use FIX macros instead of generic NUM macros if possible
They're slightly faster when we know a number is small enough to be a FIXNUM.
2010-02-13ext: fix memory leak when reentrant/multithreaded v0.3.1
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.
2010-02-08Allow :reentrant flag to be forced true/false
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"
2010-01-06ext: unpack response arrays unconditionally
It's too crazy to have to special case for frozen response constants. 3-element arrays are cheap under Ruby 1.9 anyways.
2009-10-06ext: ensure all objects we byte_xs are Strings
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.
2009-10-06ext: convert non-Hashes #to_hash if possible
This is to remain compatible with Rack if it relaxes Rack::Lint to allow subclasses.
2009-09-09handle bodies that do not respond to :close
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
2009-09-07ext: fix compiler warnings in the cpp "comment"
2009-09-07Don't bother creating HeaderHash unless we need it
It's expensive to create if not needed, and no current released version of Rack has my proposed optimizations for it yet...
2009-09-07enable MRI C extension by default
It was too much confusion to have multiple gems in the mix and I mainly use the C extension anyways. If we're not on a compatible version of Ruby, the extension will just be disabled by generating a dummy no-op Makefile to work around it.
2009-09-07ext: hack to prevent rdoc from finding Rack* namespace
TODO: find a better way to do this...
2009-09-04ext: only duplicate frozen response arrays
Otherwise modify the response array in place since most frameworks give you a modifiable array for you to play with anyways.
2009-09-04use Rack::Utils::HeaderHash for $sent_http_* lookups
No point in having extra code to do case-insensitive lookups, especially since the HeaderHash implementation is already in wide use and will only get faster as time goes by.
2009-09-04ext: store each response element explicitly
Avoid calling RARRAY_PTR all over the place and make the code easier to read/audit as a result.
2009-09-04ext: more consistent function naming
s/init_bad_response/init_bad_app_response/ The new name matches the variable it initializes more closely.
2009-09-03add output record separator option (:ORS)
This allows overriding the default of "\n". Behavior remains similar to IO#puts, the :ORS (output record separator) is appended iff the format doesn't already end with that string.
2009-09-03Ensure underlying logger objects are sync=true
Userspace buffering defaults are dangerous as the Ruby default IO objects do not do line-aware buffering. This makes the README examples with File.open much safer to use out-of-the-box for users of the pure-Ruby version. For users on the MRI C extension logging to regular files, this should not have any effect as we've optimized those to do unbuffered write(2) syscalls anyways.
2009-09-01correctly rebuild simple HTTP/0.9 GET requests
Back in HTTP/0.9 days (before it was called HTTP/0.9), "GET /uri/goes/here\r\n" was a valid HTTP request. See rfc 1945, section 4.1 for details on this ancient "Simple-Request" scheme used by HTTP/0.9 clients.
2009-09-01ext: ensure headers#each in response is valid
We're not Rack::Lint, but we still need to take steps to avoid segfaulting if we host non-Rack::Lint-compliant applications. This also updates the pure variant to fail on bad applications, too.
2009-09-01ext: compiler compatibility fix
Remove trailing "," for enum
2009-08-29ext: several cleanups and robustness improvements
Add a little more tolerance for bad applications that may not give us string objects. This should only have a minor performance penalty for proper applications but at least ensures we don't segfault on misbehaving apps.
2009-08-29ext: explicitly gc_mark each struct element
rb_gc_mark_locations doesn't seem in common use for structs and there was a fencepost error so the response element didn't seem to be marked at times. This should fix random errors I've been seeing on big/longer response bodies.
2009-08-29Log bad/invalid app responses as 500 errors
Some misbehaved apps can do this to us, and we don't want the C extension to segfault when this happens.
2009-08-29support "$request_uri" as a log variable
This was documented in the README but never implemented. Some popular web servers set REQUEST_URI even though it's not required by Rack, so allow this variable to be used if possible. As a side effect, it is also less likely to be modified by certain handlers (*cough*Rails::Rack::Static*cough*).
2009-08-28initial import