about summary refs log tree commit homepage
path: root/lib/yahns/http_context.rb
DateCommit message (Collapse)
2016-02-14http_context: reduce constant lookup + bytecode
This saves about 100 bytes of iseq overhead based on my measurements.
2016-02-12set HTTPS and rack.url_scheme in Rack env as appropriate
env['HTTPS'] is not documented in rack SPEC, but appears to be used by Rack::Request since 2010[*]. Also, set rack.url_scheme as documented by rack SPEC. [*] - commit 4defbe5d7c07b3ba721ff34a8ff59fde480a4a9f ("Improves performance by lazy loading the session.")
2016-01-04avoid StringIO#binmode for the next few years
Apparently, StringIO#binmode has been totally broken in 1.9+ and I've always hidden this bug with the combination of an explicit string and magic "encoding: binary" comments :x ref: https://bugs.ruby-lang.org/issues/11945
2016-01-02copyright updates for 2016
Using the 'update-copyright' script from gnulib[1]: git ls-files | UPDATE_COPYRIGHT_HOLDER='all contributors' \ UPDATE_COPYRIGHT_USE_INTERVALS=2 \ xargs /path/to/gnulib/build-aux/update-copyright We're also switching to 'GPL-3.0+' as recommended by SPDX to be consistent with our gemspec and other metadata (as opposed to the longer but equivalent "GPLv3 or later"). [1] git://git.savannah.gnu.org/gnulib.git
2016-01-02enable frozen_string_literal for Ruby 2.3+
There are likely yet-to-be-discovered bugs in here. Also, keeping explicit #freeze calls for 2.2 users, since most users have not migrated to 2.3, yet.
2015-10-13copyright updates
Future updates may use the update-copyright script in gnulib: git ls-files | UPDATE_COPYRIGHT_HOLDER='all contributors' \ UPDATE_COPYRIGHT_USE_INTERVALS=2 \ xargs /path/to/gnulib/build-aux/update-copyright
2015-05-09support for Rack::TempfileReaper middleware
Rack::TempfileReaper was added in rack 1.6 to cleanup temporary files. Make Yahns::TmpIO ducktype-compatible and put it into env['rack.tempfiles'] array so Rack::TempfileReaper may be used to free up space used by temporary buffer files. ref: commit 3bdf5481e49d76b4502c51e5bdd93f68bfd1f0b4 in unicorn
2015-04-22favor #nil? instead of "== nil" comparisons in cold code
We don't need optimized dispatch methods in cold code, so use the more space-efficient "nil?" method dispatch to save us one word per-call site for a rough total of 24 bytes saving.
2015-04-07http_context: avoid defining our own *buffer_tmpdir methods
Instance variable attr methods are cheaper and we can shove the complexity down to tmpio by allowing it to accept a nil argument for the temporary directory. This adds 4 bytes to tmpio but removes over 1K in http_context on a 32-bit system.
2014-11-20remove unused client_max_header_size config
We may not be able to support this in a more performant way just yet. Since this was never documented, we'll remove the the current knobs for silently setting and ignoring it. Users should use Unicorn::HttpParser.max_header_len= for now, instead. We may change Unicorn::HttpParser in the future if enough people care about making this functionality per-app.
2014-10-13switch to require_relative for internal requires
This speeds up searching during startup and prevents accidentally misloading different, potentially incompatible versions of yahns code.
2013-11-01input and output buffers support tmpdir: arguments
This allows users to specify alternative temporary directories in case buffers get too large for one filesystem to handle or to give priority to some clients on certain ports.
2013-10-30Rack hijack issues EPOLL_CTL_DEL
This saves about 200 bytes of unswappable kernel memory, so it might matter for systems with many connections when hijacking.
2013-10-29lower client_body_buffer_size to 8K (from 114K)
8K is the default for nginx, too. This prevents Ruby/malloc from getting too fragmented with large buffers and being unable to release memory back to the OS. While we're at it, update the documentation to reflect we use this parameter to control read(2) sizes, too.
2013-10-19wire up client_max_body_size limits
This is mostly code imported from Rainbows! (so GPLv2+). This should implement everything necessary to prevent clients from DoS-ing us with overly large bodies. The default is 1M (same as Rainbows! and nginx). Yahns::MaxBody may become part of the public API (as the equivalent is in Rainbows!), since it makes more sense in the rackup (config.ru) file (since it's endpoint-specific). However, that's confusing as Yahns::MaxBody only works when input_buffering is :lazy or false, and not when it is true (preread).
2013-10-18remove tiny_input
Since we are smarter about closing @input, we can just call .close on it as closing inputs is forbidden in Rack apps, anyways. This reduces our class count and should make things easier to follow.
2013-10-18initial commit