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,5 +1,6 @@
|
|||
{-# LANGUAGE CPP #-}
|
||||
module Backend.Backend where
|
||||
|
||||
|
||||
import Control.Concurrent.MVar
|
||||
import qualified Network.Wai as Wai
|
||||
|
||||
|
@ -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 ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue