packages feed

diohsc 0.1.14.7 → 0.1.15

raw patch · 8 files changed

+50/−18 lines, 8 filesdep ~tls

Dependency ranges changed: tls

Files

ANSIColour.hs view
@@ -9,6 +9,7 @@ -- along with this program.  If not, see http://www.gnu.org/licenses/.  {-# LANGUAGE BangPatterns      #-}+{-# LANGUAGE LambdaCase        #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE Safe              #-} @@ -30,6 +31,7 @@     , escapePromptCSI     , sanitiseForDisplay     , stripControl+    , stripControlExceptTab     , Colour(..)     ) where @@ -157,9 +159,16 @@         "[" -> T.cons '\ESC' s         _   -> "\\ESC" <> s --- |strip all C0 and C1 control chars+-- |strip all C0 and C1 control chars, replacing tab with space stripControl :: T.Text -> T.Text-stripControl = T.filter $ (>= 0) . wcwidth+stripControl = T.concatMap $ \case+    '\t'               -> " "+    c | wcwidth c == 0 -> ""+    c                  -> T.singleton c++-- |strip all C0 and C1 control chars except '\t'+stripControlExceptTab :: T.Text -> T.Text+stripControlExceptTab = T.filter $ \c -> c == '\t' || wcwidth c > 0  -- |strip all C0 and C1 control chars except tab, and esc where it introduces -- a CSI escape sequence. (Might be even better to strip all but SGR, but that
CHANGELOG.md view
@@ -2,6 +2,12 @@ This file covers only non-trivial user-visible changes; see the git log for full gory details. +# 0.1.15+* Switch tls dependency to tls-2.0; deprecated ciphers dropped+* Handle 44 response with exponential backoff+* Fix regression wherein queue files weren't read after start+* Fix handling of tabs+ # 0.1.14 * Run $EDITOR on input/query ending with backslash * Strip all control characters (including ANSI formatting) outside preformatted blocks
GeminiProtocol.hs view
@@ -189,7 +189,10 @@         let serverId = if port == defaultGeminiPort then BS.empty else TS.encodeUtf8 . TS.pack . (':':) $ show port             sessionManager = clientSessionManager 3600 clientSessions ccfp             params = (TLS.defaultParamsClient hostname serverId)-                { clientSupported = def { supportedCiphers = gemini_ciphersuite }+                { clientSupported = def+                    { supportedCiphers = gemini_ciphersuite+                    , supportedExtendedMainSecret = AllowEMS+                    }                 -- |RFC6066 disallows SNI with literal IP addresses                 , clientUseServerNameIndication = not $ isIPv4address hostname || isIPv6address hostname                 , clientHooks = def@@ -229,13 +232,16 @@             sock <- openSocket             c <- TLS.contextNew sock params             handle retryNoResume $ handshake c >> return (sock,c)-        sendData context $ BL.fromStrict requestBytes-        when verboseConnection . void . runMaybeT $ do+        void . runMaybeT $ do             info <- MaybeT $ contextGetInformation context-            lift . displayInfo $ [ "TLS version " ++ show (infoVersion info) ++-                ", cipher " ++ cipherName (infoCipher info) ]-            mode <- MaybeT . return $ infoTLS13HandshakeMode info-            lift . displayInfo $ [ "Handshake mode " ++ show mode ]+            when (infoVersion info == TLS12 && not (infoExtendedMainSecret info) && isJust mIdent) $ do+                lift $ displayWarning [ "TLS1.2 server without EMS support is vulnerable to triple-handshake attack." ]+            when verboseConnection $ do+                lift . displayInfo $ [ "TLS version " ++ show (infoVersion info) +++                    ", cipher " ++ cipherName (infoCipher info) ]+                mode <- MaybeT . return $ infoTLS13HandshakeMode info+                lift . displayInfo $ [ "Handshake mode " ++ show mode ]+        sendData context $ BL.fromStrict requestBytes         chan <- newBSChan bound         let recvAllLazily = do                 r <- recvData context@@ -493,7 +499,7 @@         then MalformedResponse BadMetaSeparator         else if BL.length header > 1024+3 then MalformedResponse BadMetaLength         else case readMay statusString of-            Just status | status >= 10 && status < 80 ->+            Just status | status >= 10 && status < 70 ->                 let (status1,status2) = divMod status 10                 in case status1 of                     1 -> Input (status2 == 1) meta
LineClient.hs view
@@ -19,6 +19,7 @@ import qualified Codec.MIME.Parse             as MIME import qualified Codec.MIME.Type              as MIME import           Control.Applicative          (Alternative, empty)+import           Control.Concurrent           (threadDelay) import           Control.Monad                (forM_, guard, join, mplus, msum,                                                mzero, unless, void, when, (<=<)) import           Control.Monad.Catch          (SomeException, bracket,@@ -134,7 +135,7 @@         findQueueFiles :: IO [(FilePath,String)]         findQueueFiles = do             qf <- (\e -> [(queueFile, "") | e]) <$> doesFileExist queueFile-            qfs <- ((\qn -> (queuesDir </> qn, qn)) <$>) <$> listDirectory queuesDir+            qfs <- ignoreIOErr $ ((\qn -> (queuesDir </> qn, qn)) <$>) <$> listDirectory queuesDir             return $ qf <> qfs         queueLine :: T.Text -> Maybe QueueItem         queueLine s = QueueURI Nothing <$> (parseUriAsAbsolute . escapeIRI $ T.unpack s)@@ -321,11 +322,16 @@     preprocessQuery = (escapeQuery <$>) . liftIO . maybeEdit         where             maybeEdit :: String -> IO String-            maybeEdit s | lastMay s == Just '\\' =+            maybeEdit s | unescapedTerminalBlash s =                 handle (\e -> printIOErr e >> pure s)                     . doRestrictedFilter (editInteractively ansi userDataDir)                     $ init s             maybeEdit s = pure s+            unescapedTerminalBlash s = case take 2 $ reverse s of+                [ '\\' ]       -> True+                [ '\\', '\\' ] -> False+                [ '\\', _ ]    -> True+                _              -> False      expand :: String -> String     expand = expandHelp ansi (fst <$> aliases) userDataDir@@ -841,6 +847,10 @@                     addIdentity req identity                     doRequest redirs req +            handleResponse (Failure 44 info) = do+                printInfo $ "Server requests slowdown: " ++ info+                liftIO . threadDelay $ 1000 * 2^redirs+                doRequest (redirs+1) req             handleResponse (Failure code info) =                 printErr $ "Server returns failure: " ++ show code ++ " " ++ info             handleResponse (MalformedResponse malformation) =@@ -942,6 +952,7 @@                     "gemini" ->                         let opts = GemRenderOpts ansi' preOpt pageWidth linkDescFirst                         in printGemDoc opts (showUriRefFull ansi' ais uri) $ parseGemini bodyText-                    _ -> T.stripEnd . stripControl <$> T.lines bodyText+                    "x-ansi" -> T.stripEnd . sanitiseForDisplay <$> T.lines bodyText+                    _ -> T.stripEnd . stripControlExceptTab <$> T.lines bodyText         mimeType ->             return . Left $ "No geminator for " ++ TS.unpack (MIME.showMIMEType mimeType) ++ " configured. Try \"save\", \"view\", \"!\", or \"|\"?"
Makefile view
@@ -1,4 +1,4 @@-VERSION=0.1.14.7+VERSION=0.1.15  GHCOPTS=-threaded -DICONV -DMAGIC -ignore-package regex-compat-tdfa 
Version.hs view
@@ -16,4 +16,4 @@ programName = "diohsc"  version :: String-version = "0.1.14.7"+version = "0.1.15"
diohsc.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.18 name:               diohsc-version:            0.1.14.7+version:            0.1.15 license:            GPL-3 license-file:       COPYING maintainer:         mbays@sdf.org@@ -116,7 +116,7 @@         temporary ==1.3.*,         terminal-size >=0.3.2.1 && <0.4,         text >=1.1.0.0 && <2.2,-        tls >=1.5.4 && <2.1,+        tls >=2.0 && <2.1,         transformers >=0.3.0.0 && <0.7,         crypton-x509 >=1.7.5 && <1.8,         crypton-x509-store >=1.6.7 && <1.7,
diohscrc.sample view
@@ -73,4 +73,4 @@ # For use with https://github.com/codesoap/gmir . # Requires perl with the URI library (which you probably have). # If you select a link in gmir, it will be added to the diohsc queue.-#alias GMIR !rel="$(gmir "%s")"; [ -n "$rel" ] && echo "$(perl -e 'use URI; print URI->new_abs(shift, shift)')' "$rel" "$URI") >> ~/.diohsc/queue"+#alias GMIR !rel="$(gmir "%s")"; [ -n "$rel" ] && echo "$(perl -e 'use URI; print URI->new_abs(shift, shift)')' "$rel" "$URI")" >> ~/.diohsc/queue