diff options
author | defanor <defanor@uberspace.net> | 2017-10-29 01:14:08 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-10-29 01:14:08 +0300 |
commit | 3b63e2bb67b82b6317ac48d054c6766d3f9a5419 (patch) | |
tree | 7ffa805b3aa711b53c6b27cbcd72f65e8606ca35 /Pancake.hs | |
parent | 60871cf9623e154dd411689d8ac592cba6d34713 (diff) |
Fix gopher URI parsing
Using `splitDirectories` for its paths (types + selectors) was a bad
idea, particularly leading to misbehaviour with "hURL:" redirects.
Diffstat (limited to 'Pancake.hs')
-rw-r--r-- | Pancake.hs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -118,15 +118,15 @@ readDoc cmd uri = do ("https:", ".php") -> html ("http:", "") -> html ("https:", "") -> html - ("gopher:", ext) -> case splitDirectories $ uriPath uri of - ("/":"1":_) -> gopher - ("/":"h":_) -> html + ("gopher:", ext) -> case uriPath uri of + ('/':'1':_) -> gopher + ('/':'h':_) -> html -- "0" should indicate plain text, but it's also the most -- suitable option for non-html markup. Not sure about this -- approach, but it's similar to ignoring HTTP content-type, -- and will do for now: better to render documents nicely -- when possible. - ("/":"0":_) -> byExtension ext <|> plain + ('/':'0':_) -> byExtension ext <|> plain -- unknown or unrecognized item type _ -> byExtension ext <|> gopher (_, ext) -> byExtension ext <|> plain |