Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpServe fix for SSL changes in Snap #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Snap/Extension/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ defaultConfig = setReloadHandler handler C.defaultConfig
-- | Completes a partial 'Config' by filling in the unspecified values with
-- the default values from 'defaultConfig'.
completeConfig :: ConfigExtend s -> ConfigExtend s
completeConfig = mappend defaultConfig
completeConfig c = case getListen c' of
[] -> addListen (ListenHttp "0.0.0.0" 8000) c'
_ -> c'
where c' = mappend defaultConfig c


------------------------------------------------------------------------------
Expand Down Expand Up @@ -132,8 +135,9 @@ httpServe config init handler = do
conf = completeConfig config
verbose = fromJust $ getVerbose conf
output = when verbose . hPutStrLn stderr
address = fromJust $ getAddress conf
port = fromJust $ getPort conf
(address, port) = case (head . getListen $ conf) of
ListenHttp a p -> (a,p)
ListenHttps a p _ _ -> (a,p)
reloader = fromJust $ getReloadHandler conf
compress = if fromJust $ getCompression conf then withCompression else id
catch500 = flip catch $ fromJust $ getErrorHandler conf
Expand Down