Date | Commit message (Collapse) |
|
Most notably release fixes TLS output buffering for large
responses to slow clients. For Rack HTTPS users,
env['SERVER_PORT'] also defaults to 443 properly unless the
Host: request header specifies differently.
Also, the extras/autoindex change is to make our own directory
listing look nicer as we use Let's Encrypt and don't want to
waste space listing ".well-known/" directory contents on:
https://yahns.yhbt.net/
Yes, we really do care how our homepage looks!
6 changes since v1.12.1:
extras/autoindex: support hiding dotfiles
fix output buffering with SSL_write
https: ensure SERVER_PORT defaults to 443
test_ssl: check SERVER_PORT when parsed from Host: header
doc: mention kqueue/kevent alongside epoll
doc: more minor updates
|
|
Remove all pandoc references. We shouldn't need to clutter our
documentation with out-of-date references to pandoc, and pod2man is
probably widely-available enough that nobody should need to install
it.
Reduce HTTP redirects when linking to external sites.
It's also excessive to mention libkqueue as using the native
implementation (whether it be kqueue or epoll) is preferred
and easier.
|
|
epoll and kqueue are similar and we use them in a similar way;
so mention kqueue alongside epoll for users who may already be
familiar with kqueue on *BSD but not epoll under Linux.
epoll is a queue, too!
|
|
We need to ensure SERVER_PORT is still parsed from the Host:
header when it is given, there.
|
|
This helps Rack::Request#url and similar methods generate proper
URLs instead of the obviously wrong: "https://example.com:80/"
Note: we don't track the actual port the listener is bound to,
and it may not be worth it since the use of the Host: header
is long-established and Host: headers include the port number
if non-standard.
|
|
The underlying SSL_write called by the OpenSSL socket when
we use write_nonblock must get the same arguments after a
call returns SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE.
Ensure that by always passing a copy of the user-supplied
buffer to OpenSSL::SSL::SSLSocket#write_nonblock and retaining
our copy of the string internally as @ssl_blocked if we hit
EAGAIN on the socket.
String#dup is inexpensive in modern Ruby, as copying a
non-embedded string is implemented using copy-on-write.
We also prefer to use write_nonblock directly instead of
using our kgio-dependent sendfile emulation layer to avoid
allocating a new string on partial writes.
ref: https://bugs.ruby-lang.org/issues/12085
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/73882
http://mid.gmane.org/redmine.issue-12085.20160219020243.4b790a77f1cdd593@ruby-lang.org
|
|
Switch option initialization to using a keyword hash
since yet-another boolean is too much.
Using kwargs won't work under Ruby 1.9.3 which we still
support (for now).
Note: being a part of extras/, there's no API stability
guarantees but this should've maintained it.
|
|
Most notably, serving static files over HTTPS did not work
before this release with the "sendfile" gem installed. The
yahns_config(5) manpage is also updated with an example for
using OpenSSL::SSL::SSLContext objects. Users of
Rack::Request#scheme and env['rack.url_scheme'] should see
"https" properly set for HTTPS connections.
There's also a bunch of internal tweaks like taking advantage of
the file-level frozen_string_literal: directive in 2.3 and
explicitly clearing short-lived string buffers
TLS support is still in its early stages, but I'm experimenting
with Let's Encrypt (via getssl[1]) and hosting https://YHBT.net/
on it.
For now, I suggest using a separate yahns instance (with a
different master process) to avoid any potential data leaks
between HTTPS and HTTP instances. In the future, it may be
possible to isolate HTTPS from HTTP at the worker process level.
Supporting GnuTLS (alongside OpenSSL) may be in our future, too.
To paraphrase the warning in http://www.postfix.org/TLS_README.html
(which was written before Heartbleed):
WARNING
By turning on TLS support in yahns, you not only get the
ability to encrypt traffic and to authenticate remote
clients. You also turn on thousands and thousands of
lines of OpenSSL library code. Assuming that OpenSSL is
written as carefully as Eric's own code, every 1000 lines
introduce one additional bug into yahns.
I'm not nearly as careful with yahns as Wietse is with postfix,
either.
20 changes since v1.11.0:
README: updates for kqueue
add .gitattributes for Ruby method detection
nodoc internals
enable frozen_string_literal for Ruby 2.3+
copyright updates for 2016
extras/exec_cgi: fix frozen string error on slow responses
avoid StringIO#binmode for the next few years
use String#clear for short-lived buffers we create
gemspec: make rack a development dependency
build: install-gem forced to "--local" domain
acceptor: all subclasses of TCPServer use TCP_INFO
properly emulate sendfile for OpenSSL sockets
avoid race conditions in OpenSSL::SSL::SSLContext#setup
set HTTPS and rack.url_scheme in Rack env as appropriate
proxy_pass: pass X-Forwarded-Proto through
doc: switch to perlpod (from pandoc-flavored Markdown)
doc: trim down documentation slightly
doc: document ssl_ctx for "listen" directive
doc: various doc and linkification improvements
http_context: reduce constant lookup + bytecode
[1] git clone https://github.com/srvrco/getssl.git
|
|
This saves about 100 bytes of iseq overhead based
on my measurements.
|
|
Correctly link to subsections within the same page, and include
a link to mailing list archives.
Also, use "ssl_ctx" consistently as a local variable as
we internally use "ctx" for other purposes.
|
|
With the advent of Let's Encrypt, we'll see more users
interested in using yahns with OpenSSL support.
So document how a listener may be passed an SSLContext.
|
|
The "threads:" option for the "listen" directive is worthless.
Having a dedicated thread per-process is already more than enough
(and ideal) for a multi-process setup. Multiple acceptor threads
is still wrong for a single-process setup (even if we did not
have a GVL) as it still incurs contention with the worker
pool within the kernel.
So remove the documentation regarding "listen ... threads: ",
for now; at least until somebody can prove it's useful and not
taking up space.
Additionally, "atfork_parent" may be useful for restarting
background threads/connections if somebody wants to run
background jobs in the master process, so stop saying
it's completely useless.
|
|
pod2man(1) and pod2text(1) are already installed on most modern
GNU/Linix systems including Debian and RedHat-based systems;
pandoc(1) and Haskell are not, and we do not wish to waste
precious bandwidth and disk space of potential packagers.
perlpod(1) is also better standardized than any Markdown flavor,
especially when it comes to generating manpages.
Finally, I'm mildly proficient at Perl (it is similar to Ruby)
and can poke around at the source if I encounter breakage.
|
|
This allows backend application servers to set "rack.url_scheme"
as appropriate using Rack::Request#scheme.
Plack/PSGI users can also take advantage of this using
Plack::Middleware::ReverseProxy
|
|
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.")
|
|
By explicitly calling OpenSSL::SSL::SSLContext#setup before
accepting connections. We cannot rely on "setup" being called
implicitly because any callbacks configured or objects
configured by the client may not be thread-safe.
We also avoid calling "setup" in the master process (if yahns is
configured to use worker processeses) in case the setup code
starts any TCP connections (e.g. to memcached for session
caching).
|
|
We cannot use the sendfile(2) syscall when serving static files
to TLS clients without breaking them. We currently rely on
OpenSSL to encrypt the data before it hits the socket, so it
must be read into userspace buffers before being written to the
socket.
|
|
This will allow Yahns::OpenSSLServer instances to take advantage
of TCP_INFO under Linux, saving us the overhead of method
invocations.
|
|
This avoids needless network traffic when installing
the locally-built gem.
|
|
We don't depend on rack directly, and unicorn 5.1 will make rack
optional. This seems reasonable for testing, but one day I could
imagine this being more than an HTTP or Rack server...
|
|
This should reduce memory pressure slightly as we can
have finer-grained control of memory usage for buffers which
can be several kilobytes large.
It is not safe to do this for output buffers we get from the
application, as they may reuse that memory themselves.
|
|
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
|
|
Oops, we need to duplicate our buffer in case the CGI executable
returns just the header :x
|
|
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
|
|
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.
|
|
We do not expose any sort of API beyond what's in the config file
manpage to our users. Do not mislead them into thinking we
currently have a stable API (though I'm considering one).
This avoids wasting disk space and installation time for users who
do not have a: "gem: --no-ri --no-rdoc" line in their ~/.gemrc
|
|
The "diff" function detection for C does not map well to
Ruby files, take advantage of gitattributes(5) to improve
method name detection in generated patches as well as
making "git diff -W" output more useful.
|
|
It's been there long enough and kqueue itself hasn't changed. In
fact, IIRC the entire design of yahns (for another server in late
2011) probably came about because of the name "kqueue"...
|
|
There's some minor test case fixes and documentation updates.
For OpenSSL users running the Ruby 2.3.0 preview releases,
we now use `exception: false' for for accept_nonblock to reduce
exceptions. Non-SSL I/O still uses kgio for now.
6 changes since 1.10.0:
wbuf: fix typo in bug check for sendfile gem
test_wbuf: deal with proper zero-copy for Unix sockets
README: clarify and update copyright year
doc: document and reference sd_listen_fds(3) behavior
test_server: fix race condition in hooks test
openssl_client: use `exception: false' for accept_nonblock
|
|
Ruby 2.3 will support this feature to reduce allocations
for common errors.
|
|
We need to ensure the master process is done writing to logs
when we check them. Do that by sending a SIGQUIT to the master
to shut it down, as the master process will defer the SIGQUIT
until after the test log is written to the kernel.
|
|
Users tend to skip reading release notes, ensure the manpage
documents this feature.
|
|
This is no place to advertise weirdo projects.
|
|
Linux 4.2 gained the ability to do true zero-copy sendfile support
for Unix sockets; so buffer space is accounted differently.
Previously Linux only avoided copies in userspace when doing
sendfile for Unix sockets, not internally within the kernel.
This kernel change has no bearing on normal code which would need to
account for concurrent draining by the client; only test code
designed to create a failure condition.
|
|
This typo would've only be triggered if the sendfile gem itself
turns out to be buggy and returns an undocumented return code.
|
|
* test_client_expire: favor Process.spawn over fork+exec
* extras/try_gzip_static: require readability on HEAD requests
* proxy_pass: quiet down ECONNRESET and EPIPE, too
* copyright updates
* update various comments
* proxy_http_response: use frozen string literal optimization
* README: add link to NNTP archive endpoint
* use olddoc 1.1.0 for generating NEWS + NEWS.atom.xml
* gemspec fixes for various RubyGems versions
* bytecode golfing to cut a few bytes of memory
* simplify sd_listen_fds emulation
* gemspec: allow compatibility with unicorn 5
|
|
We've been compatible for a while, actually, and probably
could've done this earlier.
We won't be dropping unicorn 4.x compatibility for a bit
in case some folks need to stick to unicorn 4.x for any
reason.
|
|
Remove unnecessary anonymous procs and conditionals to save some
bytecode memory Also, no valid PID can be zero, as kill(2)
treats zero specially.
|
|
Reduce unnecessary arguments to "exit" and "exit!". Additionally,
rely on a "putnil" instruction rather than a "putstring" argument
with an unnecessary string operand for an uncommon code path.
|
|
Version may not be frozen in some RubyGems versions, so we must dup
it. Use a SPDX-compatible license string for GPL-3.0+, too
(RubyGems still complains, for now)
|
|
This removes the build-time dependency on Nokogiri, which can
be time-consuming to install. We won't be supporting any public
APIs, so we will not actually support RDoc here.
|
|
The service seems stable and reliable enough to advertise in our
README.
|
|
This can reduce the amount of garbage we have by a small
amount. Once Ruby 2.3 comes out, we can rely on the
"frozen_string_literal: true" directive
|
|
Clarify APP_CONFIG is only public for modules maintained within
yahns, not external users.
While we're at it, avoid the http:// -> https:// redirect for
bugs.ruby-lang.org in the comment.
|
|
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
|
|
Clients may disconnect on us while we're writing the response
here, so we should shut the backtrace up to avoid polluting
logs.
|
|
Files may exist and be stat-able, but not readable. Return
a 403 response for non-readable files.
|
|
Process.spawn is faster under Linux since it may use vfork
to avoid marking pages copy-on-write.
|
|
This release improves socket inheritance support. TCP socket
options are now applied to inherited sockets. We also emulate
the sd_listen_fds function to allow inheriting sockets from
systemd.
HTTP status strings are now generated dynamically, allowing
applications to modify Rack::Utils::HTTP_STATUS_CODES to
apply changes in the Rack response. Unfortunately, this leads
to minor (likely unnoticeable) performance regressions.
However, our code is not optimized for Ruby 2.2+, so users on
the latest released Ruby will benefit from reduced inline cache
and constant lookups as we reduced our constant footprint.
Expect further minor performance regressions if you are running
Ruby 2.2 and earlier.
For Ruby 2.2 users, overall performance should be largely
unchanged from 1.7.0 to 1.8.0
shortlog of changes since 1.7.0:
* use opt_str_freeze for Hash#delete
* test/helper: warn atomically
* generate response status strings dynamically
* reduce constants and optimize for Ruby 2.2+
* http_response: reduce bytecode size
* apply TCP socket options on inherited sockets
* test/test_rack_hijack.rb: try to increase test reliability
* emulate sd_listen_fds for systemd support
* test/test_rack_hijack: ensure proper ordering of log messages
|
|
Unfortunately we cannot rely on the RubyVM for optimizing hash
deletions, yet, so manually freeze for this string since it
(unlike every line after it) is a hot path if handling request
bodies.
Update a comment while we're at it.
|