return partial results early

When using Excon with a service that streams responses chunk by chunk, it currently blocks and waits until either chunk_size is reached or the full response is received. For some services, it is helpful to get partial results early and act on them (e.g. tickers or long-running requests).

Socket#read will raise an error when the user tries to read before the buffer is ready. This is normal with chunky responses. So when the read jumps into the rescue clause, check if something is already in the buffer. If so, don't wait and retry, but deliver the result first and retry after.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
when making requests without a block, get the full response instead of just the first chunk

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
Support setting ssl_verify_callback
Merge pull request #379 from lmars/ssl-verify-callback

Support setting ssl_verify_callback
ensure explicit stub params override uri components

closes #381
update rack to 1.5

Needed to intercept server responses via rack.hijack. It is required to create asynchronous responses in Unicorn, which added support back in 4.6.0.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
add support for running unicorn tests via regular socket

unicorn tests are only used in the test suite to run the unix socket tests so far. Since Webrick can't handle rack.hijack headers and thus streaming a response, but unicorn can, make unicorn available for simple tests

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
remove unused middleware from unicorn

unicorn by default will load a stack of middleware, including a standard rack layer for chunked responses. This gets in the way of streamed responses, which don't operate with the syntax of Transfer-Encoding: chunked. Unless it is required later on, disable the middleware layer here.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
update unicorn version 4.6.3 -> 4.8.3 for tests

Running streaming tests with unicorn 4.6.3 produces some unexplained errors with the test suite. Updating solved these issues.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
add tests to validate streamy responses

add a test for blocking calls against streamy endpoints. the result must block and only deliver once all parts have been delivered.

add another test with a response_block, that should get each piece of the response at appropriate timing intervals.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
don't run streaming tests on jruby

since they depend on unicode and that doesn't work right now. use an alternative server later on, that supports rack.hijack as well as java.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
add missing tests rackup to gemspec

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
simplify check if read_buffer is empty

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
Merge pull request #378 from arlimus/chunky-response

return partial results early