Errors which are the fault of the client should not generate
backtraces which can lead to dinky servers running out-of-space.
---
 lib/yahns/http_client.rb | 12 ++++++++++--
 1 file 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 @@ def handle_error(e)
     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
-- 
EW

--
unsubscribe: [email protected]
archive: https://yhbt.net/yahns-public/

Reply via email to