about summary refs log tree commit homepage
path: root/test
DateCommit message (Collapse)
2009-08-15Remove explicit requires for Rack things
Rack is autoload-based and so are we.
2009-08-15http: support for "Connection: keep-alive"
ab still sends this with HTTP/1.0 requests, which is unfortunate, but synthetic benchmarks are good for marketing purposes!
2009-08-15http_response: pass through unknown status codes
This lets clients can pass through newly-invented status codes that Rack does not know about.
2009-08-15Drop the micro benchmarks
It's not worth the effort to keep the internal API consistent between non-bugfix versions.
2009-08-15tee_input: make interface more usable outside of Unicorn
TeeInput being needed is now (once again) an uncommon code path so there's no point in relying on global constants. While we're at it, allow StringIO to be used in the presence of small inputs; too.
2009-08-15http_request: reinstate empty StringIO optimization
This makes a noticeable difference on light GET/HEAD requests. Heck, even the tests run a few seconds faster.
2009-08-11http: add "HttpParser#keepalive?" method
This should be used to detect if a request can really handle keepalives and pipelining. Currently, the rules are: 1. MUST be a GET or HEAD request 2. MUST be HTTP/1.1 3. MUST NOT have "Connection: close" set This also reduces the amount of garbage we create by globalizing constants and using them whenever possible.
2009-08-10http: rename read_body to filter_body
This method is strictly a filter, it does no I/O so "read" is not an appropriate name to give it.
2009-08-10test_signals: unlink log files of KILL-ed process
The normal at_exit handlers can't work here
2009-08-09test_exec: wait for worker readiness
Otherwise Ruby could get confused and not be able to reap the process correctly (and thus wait a long time for timeout).
2009-08-09test_util: explicitly close tempfiles for GC-safety
Otherwise they might be picked up by the GC during the other tests (exposed by Ruby 1.9.1-p243).
2009-08-09http: join repeated headers with a comma
Since Rack requires a Hash object, this is joined in in accordance with rfc2616, section 4.2[1]. Of course, it's up to the framework or application to handle such requests. I could optimize this to avoid creating a single garbage String object, but I don't think it's common enough to worry about... [1] - http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
2009-08-09http: add test for invalid trailer
Just in case clients decide to get cute.
2009-08-09http: unit tests for overflow and bad lengths
We're bound by the maximum value of off_t when handling input bodies (we need to buffer to disk). Also ensure we stop bad clients that send us unparseable lengths.
2009-08-09Switch to Ragel/C-based chunk/trailer parser
This should be more robust, faster and easier to deal with than the ugly proof-of-concept regexp-based ones.
2009-08-09test_upload: extra CRLF is needed
Our current TrailerParser is liberal and does not require it, but the to-be-activated Ragel one is not.
2009-08-09http: preliminary chunk decoding
2009-07-20Update Rails tests to run on Rails 2.3.3.1
2009-07-19fix tests to run correctly under 1.9.2preview1
test/test_helper doesn't seem to be required correctly anymore, since we know our own module/test names don't conflict, just fix RUBYLIB to include $(test_prefix) With test_util.rb, using #reopen with Tempfile objects seems prone to the objects being closed. Not completely sure what is going on but I'll just sidestep around it since I've stopped trusting Tempfile by now...
2009-07-16move all #gets logic to tee_input out of chunked_reader
This simplifies chunked_reader substantially with a slight increase in tee_input complexity. This is beneficial because chunked_reader is more complex to begin with and more likely to experience correctness issues.
2009-07-15Rename unicorn/http11 => unicorn_http
We couldn't do proper namespacing for the C module so there was a potential conflict with Init_http11() in Mongrel. This was needed because Mongrel's HTTP parser could be used in some applications and we may be unfortunate enough need to support them.
2009-07-04Favor Struct members to instance variables
There's a small memory reduction to be had when forking oodles of processes and the Perl hacker in me still gets confused into thinking those are arrays...
2009-07-01Force streaming input onto apps by default
This change gives applications full control to deny clients from uploading unwanted message bodies. This also paves the way for doing things like upload progress notification within applications in a Rack::Lint-compatible manner. Since we don't support HTTP keepalive, so we have more freedom here by being able to close TCP connections and deny clients the ability to write to us (and thus wasting our bandwidth). While I could've left this feature off by default indefinitely for maximum backwards compatibility (for arguably broken applications), Unicorn is not and has never been about supporting the lowest common denominator.
2009-06-30TrailerParser integration into ChunkedReader
Support for the "Trailer:" header and associated Trailer lines should be reasonably well supported now
2009-06-30trailer_parser: set keys with "HTTP_" prefix
2009-06-30chunked_reader: Add test for chunk parse failure
I'd honestly be more comfortable doing this in C (and possibly adapting the code from the libcurl internals since that code has been very well-tested).
2009-06-30Add trailer_parser for parsing trailers
Eventually this (and ChunkedReader) may be done in C/Ragel along with the existing HttpParser.
2009-06-29chunked_reader: simpler interface
This won't be heavily used enough to make preallocation worth the effort. While we're at it, don't enforce policy by forcing the readpartial buffer to be Encoding::BINARY (even though it /should/ be :), it's up to the user of the interface to decide.
2009-06-29configurator: provide stream_input (true|false) option
The default is false because some applications were not written to handle partial reads (even though IO#read allows it, not just IO#readpartial).
2009-06-29"Fix" tests that break with stream_input=false
2009-06-29test_rails: workaround long-standing 1.9 bug
Now that I've beefed out my Makefile to detect errors, I've noticed this test has been failing under 1.9 for a while now. Currently no released version of Rack(1.0) or Rails(2.3.2.1) supports this.
2009-06-29test_upload: fix ECONNRESET with 1.9
This has been broken since 6945342a1f0a4caaa918f2b0b1efef88824439e0 "Transfer-Encoding: chunked streaming input support" but somehow never caught by me or anyone else.
2009-06-29test_upload: add tests for chunked encoding
Additionally, provide verifications for sizes after-the-fact to avoid slamming all of our input into the server.
2009-06-10Optimize body-less GET/HEAD requests (again)
No point in making syscalls to deal with empty bodies. Reinstate usage of the NULL_IO object which allows us to avoid allocating new objects.
2009-06-05Transfer-Encoding: chunked streaming input support
This adds support for handling POST/PUT request bodies sent with chunked transfer encodings ("Transfer-Encoding: chunked"). Attention has been paid to ensure that a client cannot OOM us by sending an extremely large chunk. This implementation is pure Ruby as the Ragel-based implementation in rfuzz didn't offer a streaming interface. It should be reasonably close to RFC-compliant but please test it in an attempt to break it. The more interesting part is the ability to stream data to the hosted Rack application as it is being transferred to the server. This can be done regardless if the input is chunked or not, enabling the streaming of POST/PUT bodies can allow the hosted Rack application to process input as it receives it. See examples/echo.ru for an example echo server over HTTP. Enabling streaming also allows Rack applications to support upload progress monitoring previously supported by Mongrel handlers. Since Rack specifies that the input needs to be rewindable, this input is written to a temporary file (a la tee(1)) as it is streamed to the application the first time. Subsequent rewinded reads will read from the temporary file instead of the socket. Streaming input to the application is disabled by default since applications may not necessarily read the entire input body before returning. Since this is a completely new feature we've never seen in any Ruby HTTP application server before, we're taking the safe route by leaving it disabled by default. Enabling this can only be done globally by changing the Unicorn HttpRequest::DEFAULTS hash: Unicorn::HttpRequest::DEFAULTS["unicorn.stream_input"] = true Similarly, a Rack application can check if streaming input is enabled by checking the value of the "unicorn.stream_input" key in the environment hashed passed to it. All of this code has only been lightly tested and test coverage is lacking at the moment. [1] - http://tools.ietf.org/html/rfc2616#section-3.6.1
2009-05-25Switch to autoload to defer requires
This should prevent Rack from being required too early on so "-I" being passed through the unicorn command-line can modify $LOAD_PATH for Rack
2009-05-22Merge branch 'benchmark'
* benchmark: Define HttpRequest#reset if missing
2009-05-22Define HttpRequest#reset if missing
Newer versions of Unicorn do not include a #reset method
2009-05-13test_response: correct OFS test
Must have multiple headers to test this effectively
2009-05-13http_response: allow string status codes
Rack::Lint says they just have to work when to_i is called on the status, so that's what we'll do.
2009-05-10Remove trickletest
This is a very important test for web servers designed to serve slow clients, but Unicorn is not that.
2009-05-10Enforce minimum timeout at 3 seconds
2 seconds is still prone to race conditions under high load. We're intentionally less accurate than we could be in order to reduce syscall and method dispatch overhead.
2009-05-04Preserve 1.9 IO encodings in reopen_logs
Ensure we preserve both internal and external encodings when reopening logs.
2009-05-04Inline and remove the HttpRequest#reset method
These potentially leaves an open file handle around until the next request hits the process, but this makes the common case faster.
2009-05-04test_signals: ready workers before connecting
Otherwise there's a chance a child won't have a socket bound by the time we're trying to connect.
2009-05-03Instant shutdown signals really mean instant shutdown
Use SIGQUIT if you're going to be nice and do graceful shutdowns. Sometimes people run real applications on this server and SIGINT/SIGTERM get lost/trapped when Object is rescued and that is not good. Also make sure we break out of the loop properly when the master is dead. Testcases added for both SIGINT and dead master handling.
2009-05-03Safer timeout handling and test case
Timeouts of less than 2 seconds are unsafe due to the lack of subsecond resolution in most POSIX filesystems. This is the trade-off for using a low-complexity solution for timeouts. Since this type of timeout is a last resort; 2 seconds is not entirely unreasonable IMNSHO. Additionally, timing out too aggressively can put us in a fork loop and slow down the system. Of course, the default is 60 seconds and most people do not bother to change it.
2009-05-03Merge commit 'origin/benchmark'
* commit 'origin/benchmark': benchmark/*: updates for newer versions of Unicorn
2009-05-03http_request: switch to readpartial over sysread
readpartial is actually as low-level as sysread is, except it's less likely to throw exceptions and won't change the blocking/non-blocking status of a file descriptor (we explicitly enable blocking I/O)
2009-05-03benchmark/*: updates for newer versions of Unicorn
* explain unicorn_peeraddr * support #readpartial in request * support #write in responses