Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Catch abrupt SSL connection termination

  • Loading branch information...
commit e9f798898f8e2abccb12ad03d2545da03c4ecb26 1 parent 1b2dfd3
@jaspervdj jaspervdj authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/Snap/Internal/Http/Server/TLS.hs
5 src/Snap/Internal/Http/Server/TLS.hs
@@ -175,10 +175,13 @@ send tickleTimeout _ (NetworkSession _ aSSL sz) bs = go bs
recv :: IO b -> NetworkSession -> IO (Maybe ByteString)
-recv _ (NetworkSession _ aSSL recvLen) = do
+recv _ (NetworkSession _ aSSL recvLen) = handle termination $ do
b <- ssl recvLen
return $! if S.null b then Nothing else Just b
ssl = unsafeCoerce aSSL
+ termination :: ConnectionAbruptlyTerminated -> IO (Maybe ByteString)
+ termination = const $ return Nothing

1 comment on commit e9f7988


Hey Jasper,

Do non-broken clients cause this exception to be generated? I think we do distinguish "connection reset by peer" from EOF in the normal socket situation, I would expect that this would be analogous for SSL. Just trying to understand the motivation here.

Please sign in to comment.
Something went wrong with that request. Please try again.