about summary refs log tree commit homepage
path: root/lib/clogger/pure.rb
DateCommit message (Collapse)
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).
2016-07-28pure: remove Rack::Utils.bytesize dependency
This method is gone from rack 2.0 and not even necessary in Ruby 1.8.7. Yes, this breaks compatibility with Ruby 1.8.6 :P
2015-02-27pure: use monotonic clock if possible
Ruby 2.1.0 and later exposes Process.clock_gettime, resulting in less garbage and access to the monotonic clock if it is available. Try to use it to achieve feature parity with the C extension (which has always used the monotonic clock if possible).
2015-02-27pure: fix reentrancy of request_time
For users unable to compile the C extension, multithreaded usage of clogger could return invalid request time measurements. This does not affect users of the C extension.
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.
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-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-01-21pure: simpler autoload trigger
No need to actually create the hash, just load the constant
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-14remove Clogger::ToPath proxy class
We can just make Clogger#respond_to? smarter and forward everything except :close to the body we're proxying.
2010-12-25fix $msec and $usec in pure Ruby variant
It was totally broken but nobody uses uses it, so it went unnoticed since the beginning of time.
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-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-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-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-06pure: use Rack::Utils.bytesize instead of String#size
hacking the C extension with RSTRING_LEN() is so much easier :P
2010-01-06pure: avoid unnecessary method dispatches
instance variable lookups are expensive as-is
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-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-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-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-01Ensure hex escaping is done in uppercase
The pure variant was using lower-case output instead of upper case, the ext variant was actually fine in this case. This is for nginx output format compatibility.
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-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