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 "certificate.pem" "key.pem")
17 { onInsecure = AllowInsecure
18 } defaultSettings { settingsPort = 3009 } app
21 case rawPathInfo req of
22 "/builder/withlen" -> builderWithLen
23 "/builder/nolen" -> builderNoLen
24 "/file/withlen" -> fileWithLen
25 "/file/nolen" -> fileNoLen
26 "/source/withlen" -> sourceWithLen
27 "/source/nolen" -> sourceNoLen
28 "/secure" -> responseLBS status200 [] $ if isSecure req then "secure" else "insecure"
31builderWithLen = responseBuilder
33 [ ("Content-Type", "text/plain")
34 , ("Content-Length", "4")
36 $ copyByteString "PONG"
38builderNoLen = responseBuilder
40 [ ("Content-Type", "text/plain")
42 $ copyByteString "PONG"
44sourceWithLen = responseSource
46 [ ("Content-Type", "text/plain")
47 , ("Content-Length", "4")
49 $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
51sourceNoLen = responseSource
53 [ ("Content-Type", "text/plain")
55 $ CL.sourceList [C.Chunk $ copyByteString "PONG"]
57fileWithLen = responseFile
59 [ ("Content-Type", "text/plain")
60 , ("Content-Length", "4")
65fileNoLen = responseFile
67 [ ("Content-Type", "text/plain")
72index p = responseBuilder status200 [("Content-Type", "text/html")] $ mconcat $ map copyByteString
73 [ "<p><a href='/builder/withlen'>builder withlen</a></p>\n"
74 , "<p><a href='/builder/nolen'>builder nolen</a></p>\n"
75 , "<p><a href='/file/withlen'>file withlen</a></p>\n"
76 , "<p><a href='/file/nolen'>file nolen</a></p>\n"
77 , "<p><a href='/source/withlen'>source withlen</a></p>\n"
78 , "<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