From 7aab38fbb37300331022152e74b0a725293f5106 Mon Sep 17 00:00:00 2001 From: mbays Date: Sat, 20 Apr 2024 00:00:00 +0000 Subject: [PATCH] adapt error handling and RTT0 to tls-2.0 --- GeminiProtocol.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/GeminiProtocol.hs b/GeminiProtocol.hs index 838a4b6..3e4f592 100644 --- a/GeminiProtocol.hs +++ b/GeminiProtocol.hs @@ -214,11 +214,11 @@ makeRequest (RequestContext (InteractionCallbacks displayInfo displayWarning _ p , clientShared = def { sharedCAStore = certStore , sharedSessionManager = sessionManager } - , clientEarlyData = Just requestBytes -- ^Send early data (RTT0) if server session allows it + , clientUseEarlyData = True -- ^Send early data (RTT0) if server session allows it , clientWantSessionResume = session } (sock,context) <- do - let retryNoResume (HandshakeFailed (Error_Protocol (_,_,HandshakeFailure))) + let retryNoResume (HandshakeFailed (Error_Protocol _ HandshakeFailure)) | isJust session = do -- Work around a mysterious problem seen with dezhemini+libssl: displayWarning [ "Handshake failure when resuming TLS session; retrying with full handshake." ] @@ -229,8 +229,7 @@ makeRequest (RequestContext (InteractionCallbacks displayInfo displayWarning _ p sock <- openSocket c <- TLS.contextNew sock params handle retryNoResume $ handshake c >> return (sock,c) - sentEarly <- (== Just True) . (infoIsEarlyDataAccepted <$>) <$> contextGetInformation context - unless sentEarly . sendData context $ BL.fromStrict requestBytes + sendData context $ BL.fromStrict requestBytes when verboseConnection . void . runMaybeT $ do info <- MaybeT $ contextGetInformation context lift . displayInfo $ [ "TLS version " ++ show (infoVersion info) ++ -- 2.11.4.GIT