1{-# LANGUAGE OverloadedStrings #-}
3import Network.Wai.Handler.Warp (defaultSettings, settingsPort)
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
10import Network.HTTP.ReverseProxy
11import Network.HTTP.Conduit
14 putStrLn "https://localhost:3009/"
15 manager <- newManager def
16 runTLS (TLSSettings "config/tls-cert" "config/tls-key") defaultSettings { settingsPort = 3009 } app
19 case rawPathInfo req of
20 "/builder/withlen" -> builderWithLen
21 "/builder/nolen" -> builderNoLen
22 "/file/withlen" -> fileWithLen
23 "/file/nolen" -> fileNoLen
24 "/source/withlen" -> sourceWithLen
25 "/source/nolen" -> sourceNoLen
28builderWithLen = ResponseBuilder
30 [ ("Content-Type", "text/plain")
31 , ("Content-Length", "4")
33 $ copyByteString "PONG"
35builderNoLen = ResponseBuilder
37 [ ("Content-Type", "text/plain")
39 $ copyByteString "PONG"
41sourceWithLen = ResponseSource
43 [ ("Content-Type", "text/plain")
44 , ("Content-Length", "4")
46 $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
48sourceNoLen = ResponseSource
50 [ ("Content-Type", "text/plain")
52 $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
54fileWithLen = ResponseFile
56 [ ("Content-Type", "text/plain")
57 , ("Content-Length", "4")
62fileNoLen = ResponseFile
64 [ ("Content-Type", "text/plain")
69index p = ResponseBuilder status200 [("Content-Type", "text/html")] $ mconcat $ map copyByteString
70 [ "<p><a href='/builder/withlen'>builder withlen</a></p>\n"
71 , "<p><a href='/builder/nolen'>builder nolen</a></p>\n"
72 , "<p><a href='/file/withlen'>file withlen</a></p>\n"
73 , "<p><a href='/file/nolen'>file nolen</a></p>\n"
74 , "<p><a href='/source/withlen'>source withlen</a></p>\n"
75 , "<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