diff options
author | Eric Wong <e@80x24.org> | 2018-07-08 07:35:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2018-08-05 20:14:56 +0000 |
commit | 7013f9e3ca6c188fa14baba52e420437fd3ac2d6 (patch) | |
tree | 827340eb1b281659597372c3e83512e301865d3e | |
parent | 53bea4d91f7376c2984858517788c042ec3a99f4 (diff) | |
download | yahns-7013f9e3ca6c188fa14baba52e420437fd3ac2d6.tar.gz |
Errors which are the fault of the client should not generate backtraces which can lead to dinky servers running out-of-space.
-rw-r--r-- | lib/yahns/http_client.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/yahns/http_client.rb b/lib/yahns/http_client.rb index d8154a4..fd97624 100644 --- a/lib/yahns/http_client.rb +++ b/lib/yahns/http_client.rb @@ -298,10 +298,18 @@ class Yahns::HttpClient < Kgio::Socket # :nodoc: when Unicorn::HttpParserError # try to tell the client they're bad 400 else + n = 500 + case e.class.to_s + when 'OpenSSL::SSL::SSLError' + if e.message.include?('wrong version number') + n = nil + e.set_backtrace([]) + end + end Yahns::Log.exception(@hs.env["rack.logger"], "app error", e) - 500 + n end - kgio_trywrite(err_response(code)) + kgio_trywrite(err_response(code)) if code rescue ensure shutdown rescue nil |