1{-# LANGUAGE OverloadedStrings #-}
3import Network.Wai.Handler.Warp (defaultSettings)
4import Network.Wai.Handler.WarpTLS
5import Network.HTTP.Types (status200)
6import Blaze.ByteString.Builder (copyByteString)
8import qualified Data.Conduit as C
9import qualified Data.Conduit.List as CL
12 putStrLn "https://localhost:3000/"
13 runTLS (TLSSettings "certificate.pem" "key.pem") defaultSettings app
16 case rawPathInfo req of
17 "/builder/withlen" -> builderWithLen
18 "/builder/nolen" -> builderNoLen
19 "/file/withlen" -> fileWithLen
20 "/file/nolen" -> fileNoLen
21 "/source/withlen" -> sourceWithLen
22 "/source/nolen" -> sourceNoLen
25builderWithLen = ResponseBuilder
27 [ ("Content-Type", "text/plain")
28 , ("Content-Length", "4")
30 $ copyByteString "PONG"
32builderNoLen = ResponseBuilder
34 [ ("Content-Type", "text/plain")
36 $ copyByteString "PONG"
38sourceWithLen = ResponseSource
40 [ ("Content-Type", "text/plain")
41 , ("Content-Length", "4")
43 $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
45sourceNoLen = ResponseSource
47 [ ("Content-Type", "text/plain")
49 $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
51fileWithLen = ResponseFile
53 [ ("Content-Type", "text/plain")
54 , ("Content-Length", "4")
59fileNoLen = ResponseFile
61 [ ("Content-Type", "text/plain")
66index p = ResponseBuilder status200 [("Content-Type", "text/html")] $ mconcat $ map copyByteString
67 [ "<p><a href='/builder/withlen'>builder withlen</a></p>\n"
68 , "<p><a href='/builder/nolen'>builder nolen</a></p>\n"
69 , "<p><a href='/file/withlen'>file withlen</a></p>\n"
70 , "<p><a href='/file/nolen'>file nolen</a></p>\n"
71 , "<p><a href='/source/withlen'>source withlen</a></p>\n"
72 , "<p><a href='/source/nolen'>source nolen</a></p>\n"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list