summaryrefslogtreecommitdiff
path: root/Pancake.hs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-10-29 22:46:39 +0300
committerdefanor <defanor@uberspace.net>2017-10-29 22:49:29 +0300
commit08c21993a7f773deb26be91c99f0e12ee3d5f54a (patch)
treedaca024f12f32253246bb0207c6a8cb73403096c /Pancake.hs
parentc06df3b88296b30d09cfdfcdba3998da5bd5d064 (diff)
Default to HTML on HTTP
Diffstat (limited to 'Pancake.hs')
-rw-r--r--Pancake.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/Pancake.hs b/Pancake.hs
index 174ac29..781e007 100644
--- a/Pancake.hs
+++ b/Pancake.hs
@@ -115,10 +115,8 @@ readDoc cmd uri = do
let reader = case (uriScheme uri, map toLower $ takeExtension $ uriPath uri) of
-- some exceptions and special cases (might be better to make
-- this configurable)
- ("http:", ".php") -> html
- ("https:", ".php") -> html
- ("http:", "") -> html
- ("https:", "") -> html
+ ("http:", ext) -> http ext
+ ("https:", ext) -> http ext
("gopher:", ext) -> case uriPath uri of
('/':'1':_) -> gopher
('/':'h':_) -> html
@@ -148,6 +146,7 @@ readDoc cmd uri = do
Left err -> putErrLn (show err) >> pure Nothing
Right (doc, _) -> pure $ pure doc
where
+ http ext = byExtension ext <|> html
html = P.getReader "html"
plain = pure . P.StringReader . const $ pure . readPlain
gopher = pure . P.StringReader . const $ pure . readGopher