about summary refs log tree commit homepage
path: root/test
DateCommit message (Collapse)
2012-11-06test_clogger: fix Ruby 1.8 test compatibility
1.8 did not support my preferred way of writing hashes with symbol keys.
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.
2012-06-08test case to simulate Rack::BodyProxy usage pattern
The use of Rack::BodyProxy#method_missing causes failures under mainline Ruby 1.9.2 and 1.9.1, but not 1.9.3. This test case exists to document this (now-fixed) bug for users stuck on older Rubies. On a side note, our usage of rb_iterate() should be rewritten to use rb_block_call() as rb_iterate() is deprecated in 1.9. A Ruby 1.9.2-p290 user privately reported this issue.
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-05-11tests: add full URL example
Could be useful for some folks.
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-16:format may be a Symbol for less typing
This allows using: use Clogger, :format => :Rack_1_0 Instead of: use Clogger, :format => Clogger::Format::Rack_1_0
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-14properly support $time_utc as documented
nginx doesn't have this, only time_local, but we do
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-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-14test_clogger_to_path: do not assume implementation details
We'll be getting rid of an unnecessary wrapper class
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-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-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-21test: fix Linux memory usage test
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-06tests for subclassing
Rack::Lint will be relaxed in the next version to allow subclasses of String and Hash objects, so ensure we're good to go when the next version of Rack hits.
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-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-02alias $http_content_{length,type} to $content_{length,type}
Since Rack doesn't allow the HTTP_CONTENT_{LENGTH,TYPE} headers, alias attempts to use those to the non-"HTTP_"-prefixed equivalents to avoid confusion on the user side (nginx also does this).
2009-09-02expose the $content_length/$content_type variables
Since the HTTP_CONTENT_LENGTH and HTTP_CONTENT_TYPE variables are not allowed by Rack, we need to allow access to the CGI variables instead.
2009-09-02expose $request_method as documented in the README
Accessing "REQUEST_METHOD" in the Rack env should be doable as a CGI-ish variable. Thanks to Iñaki Baz Castillo for spotting the issue and reporting it to me.
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