clean up build warnings when built w/o servant

This commit is contained in:
Joey Hess 2024-07-31 14:07:30 -04:00
parent ffba57c9fc
commit 7c6c3e703b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -11,8 +11,8 @@ module P2P.Http.Url where
import Data.List
import Network.URI
import System.FilePath.Posix as P
#ifdef WITH_SERVANT
import System.FilePath.Posix as P
import Servant.Client (BaseUrl(..), Scheme(..))
import Text.Read
#endif
@ -37,13 +37,14 @@ parseP2PHttpUrl :: String -> Maybe P2PHttpUrl
parseP2PHttpUrl us
| isP2PHttpProtocolUrl us = case parseURI (drop prefixlen us) of
Nothing -> Nothing
Just u ->
#ifdef WITH_SERVANT
Just u ->
case uriScheme u of
"http:" -> mkbaseurl Http u
"https:" -> mkbaseurl Https u
_ -> Nothing
#else
Just _u ->
Just $ P2PHttpUrl us
#endif
| otherwise = Nothing