Haskell に Web ページが存在するかどうかを確認する方法を見つけようとしています。サーバーは HTTP2/HTTPS のみで、ページがサーバント アプリケーションに存在するかどうかを確認しようとしています。
ステータス コードが 200 か 404 かを確認するだけの適切なドキュメントを含む Haskell パッケージはありますか? 強力な HTTPS および HTTP2 サーバーを使用していますか?
ここで私は現在httpコンジットで持っていますが、奇妙な例外を受け取っています (TlsExceptionHostPort (HandshakeFailed (Error_Protocol ("expecting server hello, got alert : [(AlertLevel_Fatal,HandshakeFailure)]",True,HandshakeFailure))) "thibaud.dauce .fr" 443 および StatusCodeException)。
... other imports
import qualified Network.HTTP.Conduit as HTTP
... other types
type AppM = ReaderT Config (EitherT ServantErr IO)
newComment :: String -> OneComment -> AppM Int64
newComment baseUrl oneComment = do
time <- liftIO getCurrentTime
response <- HTTP.withManager $ \manager -> do
request <- HTTP.parseUrl $ url oneComment
HTTP.httpLbs request manager
case (statusIsSuccessful $ HTTP.responseStatus response, startswith baseUrl (url oneComment)) of
(_, False) -> return 0
(True, True) -> do
theNewComment <- runDb $ insert $ Comment (url oneComment) (content oneComment) time
return $ fromSqlKey theNewComment
_ -> return 0