shredded FastCGI and CGI support, as they are incompatible with WebSocket 😢
This commit is contained in:
parent
49f3b092be
commit
cf946f960c
9 changed files with 20 additions and 113 deletions
|
@ -1,3 +1,4 @@
|
|||
{-# LANGUAGE CPP #-}
|
||||
module Backend.Backend where
|
||||
|
||||
import Control.Concurrent.MVar
|
||||
|
@ -9,12 +10,6 @@ import qualified Backend.Http as HTTP
|
|||
#ifdef HTTPS_SUPPORT
|
||||
import qualified Backend.Https as HTTPS
|
||||
#endif
|
||||
#ifdef FASTCGI_SUPPORT
|
||||
import qualified Backend.FastCGI as FASTCGI
|
||||
#endif
|
||||
#ifdef CGI_SUPPORT
|
||||
import qualified Backend.CGI as CGI
|
||||
#endif
|
||||
-- maybe we want a String instead of T.Text depends on
|
||||
-- the argument parser
|
||||
|
||||
|
@ -40,11 +35,5 @@ backends =
|
|||
#endif
|
||||
#ifdef HTTPS_SUPPORT
|
||||
BackendWithConfig HTTPS.forkHttpsBackend "https" "Host as as simple https server, using Warp" :
|
||||
#endif
|
||||
#ifdef FASTCGI_SUPPORT
|
||||
BackendWithoutConfig FASTCGI.forkFastCGIBackend "fastcgi" "Deploy with fastcgi" :
|
||||
#endif
|
||||
#ifdef CGI_SUPPORT
|
||||
BackendWithoutConfig CGI.forkCGIBackend "cgi" "Deploy with cgi" :
|
||||
#endif
|
||||
[]
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
module Backend.CGI(forkCGIBackend) where
|
||||
|
||||
import Config
|
||||
import qualified Network.Wai as Wai
|
||||
import qualified Network.Wai.Handler.CGI as CGI
|
||||
import Control.Concurrent.MVar
|
||||
|
||||
forkCGIBackend :: Wai.Application -> IO [MVar ()]
|
||||
forkCGIBackend = fmap (: []) . forkBackend . CGI.run
|
||||
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
module Backend.FastCGI where
|
||||
|
||||
import Config
|
||||
import qualified Network.Wai as Wai
|
||||
import qualified Network.Wai.Handler.FastCGI as Fcgi
|
||||
import Control.Concurrent.MVar
|
||||
|
||||
forkFastCGIBackend :: Wai.Application -> IO [MVar ()]
|
||||
forkFastCGIBackend = fmap (: []) . forkBackend . Fcgi.run
|
|
@ -1,3 +1,11 @@
|
|||
{-# LANGUAGE CPP #-}
|
||||
#ifndef HTTP_SUPPORT
|
||||
module Backend.Http
|
||||
where
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HTTP_SUPPORT
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
-- we export a bit more than we have to, because the https module can reuse these things.
|
||||
|
@ -78,3 +86,4 @@ httpToWarpConfig config' = HTTP.setPort confPort $ HTTP.setHost (fromString conf
|
|||
|
||||
backend :: Wai.Application -> HttpConfiguration -> IO ()
|
||||
backend app config = HTTP.runSettings (httpToWarpConfig config) app
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
{-# LANGUAGE CPP #-}
|
||||
#ifndef HTTPS_SUPPORT
|
||||
module Backend.Https
|
||||
where
|
||||
|
||||
#else
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Backend.Https (forkHttpsBackend, httpsDefaultSettings) where
|
||||
|
@ -74,3 +80,4 @@ httpsToWarpConfig = httpToWarpConfig . fst
|
|||
|
||||
backend :: Wai.Application -> HttpsConfiguration -> IO ()
|
||||
backend app conf = HTTPS.runTLS (httpsToWarpTLSConfig conf) (httpsToWarpConfig conf) app
|
||||
#endif
|
||||
|
|
17
app/Main.hs
17
app/Main.hs
|
@ -15,23 +15,6 @@ import Control.Concurrent
|
|||
import Backend.Backend
|
||||
import Options.Applicative
|
||||
|
||||
#ifdef HTTP_SUPPORT
|
||||
import qualified Network.Wai.Handler.Warp as HTTP
|
||||
#endif
|
||||
|
||||
#ifdef HTTPS_SUPPORT
|
||||
import qualified Network.Wai.Handler.WarpTLS as HTTPS
|
||||
import qualified Network.Wai.Handler.Warp as HTTP
|
||||
#endif
|
||||
|
||||
#ifdef FASTCGI_SUPPORT
|
||||
import qualified Network.Wai.Handler.FastCGI as FastCGI
|
||||
#endif
|
||||
|
||||
#ifdef CGI_SUPPORT
|
||||
import qualified Network.Wai.Handler.CGI as CGI
|
||||
#endif
|
||||
|
||||
-- maybe we should use Control.Concurrent.ParallelIO but right
|
||||
-- now we just rely that the backends fork and don't block
|
||||
main :: IO ()
|
||||
|
|
26
package.yaml
26
package.yaml
|
@ -28,14 +28,6 @@ flags:
|
|||
description: Build with https support
|
||||
manual: true
|
||||
default: true
|
||||
fast-cgi:
|
||||
description: Build with fastcgi support -- this depends on the fcgi c library
|
||||
manual: true
|
||||
default: true
|
||||
cgi:
|
||||
description: Build with cgi support
|
||||
manual: true
|
||||
default: true
|
||||
|
||||
dependencies:
|
||||
- base >= 4.7 && < 5
|
||||
|
@ -62,15 +54,6 @@ when:
|
|||
dependencies:
|
||||
- warp-tls
|
||||
- warp
|
||||
- condition: flag(fast-cgi)
|
||||
dependencies:
|
||||
- wai-handler-fastcgi
|
||||
- condition: flag(cgi)
|
||||
dependencies:
|
||||
wai-extra
|
||||
|
||||
build-tools:
|
||||
- cpphs
|
||||
|
||||
executables:
|
||||
tickLeisteServer:
|
||||
|
@ -80,9 +63,6 @@ executables:
|
|||
- -threaded
|
||||
- -rtsopts
|
||||
- -with-rtsopts=-N
|
||||
- -cpp
|
||||
- -pgmP cpphs
|
||||
- -optP --cpp
|
||||
when:
|
||||
- condition: flag(http)
|
||||
cpp-options:
|
||||
|
@ -90,12 +70,6 @@ executables:
|
|||
- condition: flag(https)
|
||||
cpp-options:
|
||||
- -DHTTPS_SUPPORT
|
||||
- condition: flag(fast-cgi)
|
||||
cpp-options:
|
||||
- -DFASTCGI_SUPPORT
|
||||
- condition: flag(cgi)
|
||||
cpp-options:
|
||||
- -DCGI_SUPPORT
|
||||
|
||||
tests:
|
||||
tickLeisteServer-test:
|
||||
|
|
|
@ -52,9 +52,7 @@ extra-deps:
|
|||
flags:
|
||||
tickLeisteServer:
|
||||
http: true
|
||||
https: true
|
||||
fast-cgi: true
|
||||
cgi: true
|
||||
https: false
|
||||
|
||||
# Extra package databases containing global packages
|
||||
# extra-package-dbs: []
|
||||
|
|
|
@ -23,16 +23,6 @@ source-repository head
|
|||
type: git
|
||||
location: https://github.com/githubuser/tickLeisteServer
|
||||
|
||||
flag cgi
|
||||
description: Build with cgi support
|
||||
manual: True
|
||||
default: True
|
||||
|
||||
flag fast-cgi
|
||||
description: Build with fastcgi support -- this depends on the fcgi c library
|
||||
manual: True
|
||||
default: True
|
||||
|
||||
flag http
|
||||
description: Build with http support
|
||||
manual: True
|
||||
|
@ -47,8 +37,6 @@ executable tickLeisteServer
|
|||
main-is: Main.hs
|
||||
other-modules:
|
||||
Backend.Backend
|
||||
Backend.CGI
|
||||
Backend.FastCGI
|
||||
Backend.Http
|
||||
Backend.Https
|
||||
Config
|
||||
|
@ -57,9 +45,7 @@ executable tickLeisteServer
|
|||
Paths_tickLeisteServer
|
||||
hs-source-dirs:
|
||||
app
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N -cpp -pgmP cpphs -optP --cpp
|
||||
build-tools:
|
||||
cpphs
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends:
|
||||
aeson
|
||||
, base >=4.7 && <5
|
||||
|
@ -83,20 +69,10 @@ executable tickLeisteServer
|
|||
build-depends:
|
||||
warp
|
||||
, warp-tls
|
||||
if flag(fast-cgi)
|
||||
build-depends:
|
||||
wai-handler-fastcgi
|
||||
if flag(cgi)
|
||||
build-depends:
|
||||
wai-extra
|
||||
if flag(http)
|
||||
cpp-options: -DHTTP_SUPPORT
|
||||
if flag(https)
|
||||
cpp-options: -DHTTPS_SUPPORT
|
||||
if flag(fast-cgi)
|
||||
cpp-options: -DFASTCGI_SUPPORT
|
||||
if flag(cgi)
|
||||
cpp-options: -DCGI_SUPPORT
|
||||
default-language: Haskell2010
|
||||
|
||||
test-suite tickLeisteServer-test
|
||||
|
@ -107,8 +83,6 @@ test-suite tickLeisteServer-test
|
|||
hs-source-dirs:
|
||||
test
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-tools:
|
||||
cpphs
|
||||
build-depends:
|
||||
aeson
|
||||
, base >=4.7 && <5
|
||||
|
@ -133,10 +107,4 @@ test-suite tickLeisteServer-test
|
|||
build-depends:
|
||||
warp
|
||||
, warp-tls
|
||||
if flag(fast-cgi)
|
||||
build-depends:
|
||||
wai-handler-fastcgi
|
||||
if flag(cgi)
|
||||
build-depends:
|
||||
wai-extra
|
||||
default-language: Haskell2010
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue