Debian Codegraph @

Network/Wai/Application/Classic/Types.hs

raw
1 {-# LANGUAGE CPP #-}
2
3 module Network.Wai.Application.Classic.Types where
4
5 import Data.ByteString (ByteString)
6 import qualified Data.ByteString.Lazy as BL (ByteString)
7 import qualified Network.HTTP.Client as H
8 import Network.Wai.Application.Classic.Path
9
10 ----------------------------------------------------------------
11
12 data ClassicAppSpec = ClassicAppSpec {
13 -- | Name specified to Server: in HTTP response.
14 softwareName :: ByteString
15 -- | A function to get HTTP's GMT Date.
16 , statusFileDir :: Path
17 }
18
19 data StatusInfo =
20 -- | HTTP status body is created from 'LB.ByteString'.
21 StatusByteString BL.ByteString
22 -- | HTTP status body is created from 'FilePath'.
23 | StatusFile Path Integer
24 -- | No HTTP status body.
25 | StatusNone
26 deriving (Eq,Show)
27
28 ----------------------------------------------------------------
29
30 data FileAppSpec = FileAppSpec {
31 -- | A file name of an index file.
32 indexFile :: Path
33 -- | Whether this is an HTML or not.
34 , isHTML :: Path -> Bool
35 }
36
37 data FileRoute = FileRoute {
38 -- | Path prefix to be matched to 'rawPathInfo'.
39 fileSrc :: Path
40 -- | Path prefix to an actual file system.
41 , fileDst :: Path
42 } deriving (Eq,Show)
43
44 ----------------------------------------------------------------
45
46 data RedirectRoute = RedirectRoute {
47 -- | Path prefix to be matched to 'rawPathInfo'.
48 redirectSrc :: Path
49 -- | Path prefix to an actual file system.
50 , redirectDst :: Path
51 } deriving (Eq,Show)
52
53 ----------------------------------------------------------------
54
55 data CgiAppSpec = CgiAppSpec {
56 -- | A file name of the default CGI.
57 indexCgi :: Path
58 } deriving (Eq,Show)
59
60 data CgiRoute = CgiRoute {
61 -- | Path prefix to be matched to 'rawPathInfo'.
62 cgiSrc :: Path
63 -- | Path prefix to an actual file system.
64 , cgiDst :: Path
65 } deriving (Eq,Show)
66
67 ----------------------------------------------------------------
68
69 data RevProxyAppSpec = RevProxyAppSpec {
70 -- | Connection manager
71 revProxyManager :: H.Manager
72 }
73
74 data RevProxyRoute = RevProxyRoute {
75 -- | Path prefix to be matched to 'rawPathInfo'.
76 revProxySrc :: Path
77 -- | Destination path prefix.
78 , revProxyDst :: Path
79 -- | Destination domain name.
80 , revProxyDomain :: ByteString
81 -- | Destination port number.
82 , revProxyPort :: Int
83 } deriving (Eq,Show)
84
85 ----------------------------------------------------------------
86
87 type Lang = Path -> Path