Date | Commit message (Collapse) |
|
|
|
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
|
|
|
|
It's expensive to create if not needed, and no current released
version of Rack has my proposed optimizations for it yet...
|
|
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.
|
|
TODO: find a better way to do this...
|
|
Otherwise modify the response array in place since
most frameworks give you a modifiable array for you
to play with anyways.
|
|
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.
|
|
Avoid calling RARRAY_PTR all over the place and make the code
easier to read/audit as a result.
|
|
s/init_bad_response/init_bad_app_response/
The new name matches the variable it initializes more closely.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Remove trailing "," for enum
|
|
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.
|
|
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.
|
|
Some misbehaved apps can do this to us, and we don't want
the C extension to segfault when this happens.
|
|
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*).
|
|
|