about summary refs log tree commit homepage
path: root/test
DateCommit message (Collapse)
2014-12-02initial cut at OpenSSL support
The current CA model and code quality of OpenSSL have long put me off from supporting TLS; however but efforts such as "Let's Encrypt" and the fallout from Heartbleed give me hope for the future. This implements, as much as possible, a "hands-off" approach to TLS support via OpenSSL. This implementation allows us to shift responsibility away from us to users and upstreams (the Ruby 'openssl' extension maintainers, software packagers, and OpenSSL project itself). This is also perhaps the easiest way for now for us, while being most powerful for users. It requires users to configure their own OpenSSL context object which we'll use as-is. This context object is used as the :ssl_ctx parameter to the "listen" directive in the yahns configuration file: require 'openssl' # we will not do this for the user, even ctx = OpenSSL::SSL::SSLContext.new # user must configure ctx here... listen 443, ssl_ctx: ctx This way, in case we support GnuTLS or other TLS libraries, there'll be less confusion as to what a user is actually using. Note: this feature requires Ruby 2.1 and later for non-kgio {read,write}_nonblock(.. exception: false) support.
2014-09-01extras/autoindex: do not link beyond top-level
No need to waste space on this (and trigger "Bad partial reference!" warnings on lynx)
2014-07-16test_server: avoid multiple workers for dead parent check
This test is less reliable when there are multiple workers as the second worker may not be ready to detect a dead parent. This is still a possible race if the master dies very quicklly before a worker is fully setup.
2014-05-12test_wbuf: workaround Linux-specific behavior
Followup-to commit ade89b5142bedbcf07f38aa062bfdbfcb8bc48d3 ("wbuf: hack to avoid response corruption on FreeBSD") It seems that we cannot test wbuf internals reliably outside of Linux, however as long as the end result (via HTTP) is unchanged on other OSes, we seem to be doing OK.
2014-03-22tests: avoid autoclose when inheriting
GC will close redundantly and lead to EBADF when finalizing. This was probably harmless as the original IO objects remained marked; but do not count on it. Seeing EBADF in a MT process is a very bad sign (inadvertant information disclosure is only one race condition away). Fortunately, this bug was limited to our test suite :)
2014-03-13test/helper: compat w/ coverage in Feature #9508
There's a feature request for better coverage support in ruby-trunk https://bugs.ruby-lang.org/issues/9508 At minimum, we need to preserve compatibility; but we should set aside time to take advantage of the extra coverage support.
2014-02-08test: log skipped tests on non-Linux systems
2014-02-08test_server: check_client_connection uses Unix sockets
TCP socket timing is too varied over different OSes, Unix sockets seem to test more reliably than TCP ones on my Debian GNU/kFreeBSD system.
2014-02-08test_client_expire: add delays for non-Linux OSes
Not all TCP stacks behave the same with timing-sensitive tests. Fortunately these timing differences aren't very critical over real networks.
2014-02-08wbuf_common: avoid trysendfile on empty sf_count
We may unnecessarily drop persistent connections from this bug, and we had an incorrect assertion in our unit test, even.
2014-02-04response: do not use MSG_MORE on empty bodies
We must not cork response headers when the response body is empty, otherwise those headers will be delayed by 200ms.
2014-02-04http_response: use kgio_syssend with MSG_MORE
If Content-Length is known, try to save some bandwidth by corking the headers until the body is sendable. This allows us to avoid sending an extra packet for small HTTP responses. This allows high-performance websites like YHBT.net to be served faster!
2013-12-27tests: document and check for ab(1) dependency
ab(1) is less common than our other dependencies, so allow tests to run without it.
2013-11-12exec_cgi: drop chunk/content-length
Leave that up to Rack::Chunked/Rack::ContentLength. Chunking ourselves interacts badly with Rack::Deflater, since Deflater will blindly deflate already-chunked portions.
2013-11-12extras/try_gzip_static: return 404 on ENOTDIR
Some attackers may try /path/to/file/foo where /path/to/file is actually a valid path to a regular file. Of course, requests like this work on dynamic websites, but not static file mappings because Unix directories and files cannot be the same thing.
2013-11-10test: workaround sockets not being binary on rbx
ref: https://github.com/rubinius/rubinius/issues/2772
2013-11-10test_server: remove unneccessary IO#wait call
This was failing under Rubinius and not necessary after all ref: https://github.com/rubysl/rubysl-io-wait/issues/2
2013-11-10test: exec_cgi test uses worker_processes
Following our own advice in commit a79a6d8775171ad5cceda9bb3a77946ba60e26ce (doc: recommend worker_processes if the app uses SIGCHLD)
2013-11-06http_response: reorder wbuf_maybe on successful early flush
We can use the wbuf_close return value instead to ensure we close tmpio properly and follow the same code path as a normal (:wait_writable-triggering) buffered response would. Add a few tests to ensure we properly close the response body for exec_cgi, where I noticed zombies and started me down this rabbit hole looking for places where the response body was not closed properly.
2013-11-05extras: add autoindex module
Unlike Rack::Directory, this this also avoids tables and CSS for preformatted HTML. This is meant to resemble nginx autoindex and index functionality (combined).
2013-11-05http_response: fix app-controlled close + test
We allow applications to drop persistent connections, this does not seem forbidden by Rack and gives the app author some control over the lifetime of a connection.
2013-11-02add extras for exec_cgi and try_gzip_static
These applications are what I'll be using to run on yahns on my personal server. Including them here will be helpful for me to find bugs. I've already found some, the following commits were directly the result of playing with these extras: * stream_file: only close FDs we opened ourselves * worker-less server should not waitpid indiscriminately * http: do not drop Content-Range from response headers
2013-11-02tests: smaller buffer for big header test
This was triggering OOM on my 32-bit machine.
2013-11-02http: do not drop Content-Range from response headers
We parse and use Content-Range, but do not drop it when sending a response since that would confuse clients.
2013-11-02account for truncated/expanded static files
When running a static file server, we must account for filesystem activity outside of our control where files may grow/shrink as they're being served. For truncated files, we must abort any persistent connections downloading a truncated file to avoid confusing clients because the Content-Length header was already set to the big value. We also must ensure (we already did so before this commit, this just adds a test for it) we do not send additional data when a file grows on us after we've started sending the response.
2013-11-01test trysendfile usage with UNIX sockets
We didn't cover this before.
2013-11-01tests: further speed up output buffering test
Increase scans of log files and use shorter sleep intervals to get faster notification of successful timeout.
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-11-01wbuf: bypass buffering if buffers are caught up
Sometimes buffering can catch up and we no longer need to use the on-disk buffer, so keep trying to flush the data out to the user to avoid VFS activity.
2013-11-01tests: more intelligent waiting for output buffering
This should speed up our tests a little while removing the dependency on md5sum(1) from coreutils.
2013-11-01config: allow Float for timeouts
Some users may care to have sub-second or fractional timeouts for various reasons. Do not reject those values to be consistent with Ruby sleep/select.
2013-10-31allow atfork_* hooks inside app blocks for ease-of-management
This should allow users to more-easily enable/disable apps and their dependent atfork_* hooks.
2013-10-31remove arity enforcement for atfork_* hooks
It's usually given as a block, so Ruby won't care about arity there. Users will get the worker ID number as the first arg, making it possible to isolate some things to certain processes (e.g. for A/B testing).
2013-10-31implement before_exec hook
This allows modifying the command-line (as an array) passed to Kernel#exec, as well as running anything necessary.
2013-10-31implement shutdown_timeout and expiry on graceful shutdown
Otherwise, the server may stay running forever if a client chooses to stay forever (and there is no FD pressure).
2013-10-30test_server: improve working_directory test robustness
We need to account for the directory change since yahns may lazily require some files. GTL is also not needed inside a child process.
2013-10-30test for overriding rack.errors destination
Different instances/ports of apps may want to point error output elsewhere.
2013-10-30test_unix_socket: remember to close IO when done
Hopefully saves us from running out of FDs when doing parallel tests.
2013-10-30add test for working_directory config parameter
This is often forgotten, and we need to make a tweak to the coverage generator to dump correctly.
2013-10-30tests for SIGTTIN and SIGTTOU
These are implemented trivially and based on working code, but test them anyways.
2013-10-30test for binding Unix stream sockets
This should prevent us from introducing bugs into some otherwise rarely-tested code.
2013-10-30allow multiple blocking threads per listen socket
This is probably not needed and just adds contention, but it makes experimenting easier. While we're at it, validate minimum values of for sndbuf/rcvbuf along with this new threads value, too.
2013-10-30test_input: close client when we're done with it
This allows us to avoid some FD leakage and waste of memory allocations.
2013-10-30test output_buffering with hijacked responses
We need to be able to resume hijacking if gigantic HTTP headers are buffered on the response.
2013-10-30stream_input: use thread-local rbuf to avoid some garbage
While we're at it, add some additional tests for input handling.
2013-10-29implement client_timeout for streaming inputs
We may also return HTTP 408 errors in this case.
2013-10-29implement user switching
This was documented (incorrectly) and not implemented for either the master/worker or single process cases. Implement and test all (with mocks, so not fully-tested).
2013-10-28associate private/anonymous queues correctly
We do not want users to use the default queue unless an app context requires it. We also do not want to spin up the default queue unless we are sure we have app contexts using it (and not private/anonymous queues).
2013-10-26test_client_expire: disable output buffering in test
We may end up buffering on headers and hitting EMFILE/ENFILE this way, too. We need to figure out a way to recover from this.
2013-10-26fix SIGCHLD w/o workers + PID file renames
We'll hit SIGCHLD if our reexec process fails on us, so the non-MP server must handle it, too. We discovered this bug while porting the PID file renaming changes from unicorn.