The following changes since commit 2f5174d4ca9764313d6be4c092e9e6c2e4f9d1e1: unicorn 4.6.3 - fix --no-default-middleware option (2013-06-21 08:00:09 +0000) are available in the git repository at: git://bogomips.org/unicorn.git master for you to fetch changes up to 9af083d7f6b97c0f5ebbdd9a42b58478a6f874b7: test_util: fix encoding test for Ruby trunk (2.1.0dev) (2013-08-17 01:09:46 +0000) ---------------------------------------------------------------- Eric Wong (2): http_server: improve handling of client-triggerable socket errors test_util: fix encoding test for Ruby trunk (2.1.0dev) lib/unicorn/http_server.rb | 9 +++++---- test/unit/test_util.rb | 10 ++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
Eric Wong
2013-Aug-17 01:20 UTC
[PATCH 1/2] http_server: improve handling of client-triggerable socket errors
We do not attempt to write HTTP responses for socket errors if clients disconnect from us unexpectedly. Additionally, we do not hide backtraces EINVAL/EBADF errors, since they are indicative of real bugs which must be fixed. We do continue to hide hide EOF, ECONNRESET, ENOTCONN, and EPIPE because clients (even "friendly") ones will break connections due to client crashes or network failure (which is common for me :P), and the backtraces from those will cause excessive logging and even become a DoS vector. --- lib/unicorn/http_server.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index cc0a705..bed24d0 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -520,9 +520,8 @@ def maintain_worker_count # the socket is closed at the end of this function def handle_error(client, e) code = case e - when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF, - Errno::ENOTCONN - 500 + when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::ENOTCONN + # client disconnected on us and there''s nothing we can do when Unicorn::RequestURITooLongError 414 when Unicorn::RequestEntityTooLargeError @@ -533,7 +532,9 @@ def handle_error(client, e) Unicorn.log_error(@logger, "app error", e) 500 end - client.kgio_trywrite(err_response(code, @request.response_start_sent)) + if code + client.kgio_trywrite(err_response(code, @request.response_start_sent)) + end client.close rescue end -- 1.8.3.2.701.g8c4e4ec _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
Eric Wong
2013-Aug-17 01:20 UTC
[PATCH 2/2] test_util: fix encoding test for Ruby trunk (2.1.0dev)
As of r40610 in ruby trunk, internal encoding is ignored if external coding is ASCII-8BIT (binary) ref: r40610 http://svn.ruby-lang.org/repos/ruby/trunk --- test/unit/test_util.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb index b8e4043..904d51c 100644 --- a/test/unit/test_util.rb +++ b/test/unit/test_util.rb @@ -80,7 +80,11 @@ def test_reopen_logs_renamed_with_internal_encoding File.open(tmp_path, "a:#{ext.to_s}:#{int.to_s}") { |fp| fp.sync = true assert_equal ext, fp.external_encoding - assert_equal int, fp.internal_encoding + + if ext != Encoding::BINARY + assert_equal int, fp.internal_encoding + end + File.unlink(tmp_path) assert ! File.exist?(tmp_path) Unicorn::Util.reopen_logs @@ -88,7 +92,9 @@ def test_reopen_logs_renamed_with_internal_encoding assert File.exist?(tmp_path) assert_equal fp.stat.inspect, File.stat(tmp_path).inspect assert_equal ext, fp.external_encoding - assert_equal int, fp.internal_encoding + if ext != Encoding::BINARY + assert_equal int, fp.internal_encoding + end assert_equal(EXPECT_FLAGS, EXPECT_FLAGS & fp.fcntl(Fcntl::F_GETFL)) assert fp.sync } -- 1.8.3.2.701.g8c4e4ec _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying