aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Cana.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Cana.hs b/src/Cana.hs
index 2e616ac..4d5c4d2 100644
--- a/src/Cana.hs
+++ b/src/Cana.hs
@@ -171,8 +171,13 @@ canaClient socket = do
}
-- | Render a response and write it to the TLS encrypted socket.
+--
+-- Note that this function also sends the TLS @close_notify@, as mandated by
+-- the TLS and the Gemini specifications.
writeResponse :: TLS.Context -> GeminiResponse -> Cana ()
-writeResponse context = TLS.sendData context . renderResponse
+writeResponse context response = do
+ TLS.sendData context $ renderResponse response
+ TLS.bye context
-- | Find the fitting route for the given request.
findRoute :: GeminiRequest -> Cana (Maybe Handler)