implemented encodeRequest
Note: this does not yet handle percent-escaped characters
This commit is contained in:
@@ -24,6 +24,25 @@ License along with this program. If not, see
|
||||
|
||||
-}
|
||||
|
||||
module Network.GemServ where
|
||||
module Network.GemServ (
|
||||
encodeRequest
|
||||
) where
|
||||
|
||||
import Data.List (intercalate)
|
||||
|
||||
import Network.GemServ.Types
|
||||
|
||||
-- | Encodes a 'Request' into a 'String'
|
||||
encodeRequest :: Request -> String
|
||||
encodeRequest req =
|
||||
"gemini://" ++ authority ++ "/" ++ path ++ query
|
||||
where
|
||||
authority = reqHost req ++ case reqPort req of
|
||||
Just port -> ':' : show port
|
||||
Nothing -> ""
|
||||
path = intercalate "/" $ reqPath req
|
||||
query = case reqQuery req of
|
||||
"" -> ""
|
||||
q -> '?' : q
|
||||
|
||||
--jl
|
||||
|
||||
Reference in New Issue
Block a user