mighttpd2 3.4.3 → 3.4.4
raw patch · 4 files changed
+21/−15 lines, 4 filesdep −io-choicedep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: io-choice
Dependency ranges changed: base
API changes (from Hackage documentation)
- Program.Mighty.Config: Option :: !Int -> !String -> !Bool -> !String -> !String -> !FilePath -> !Bool -> !FilePath -> !Int -> !Int -> !FilePath -> !FilePath -> !FilePath -> !Int -> !Int -> !Int -> !String -> !(Maybe FilePath) -> !Int -> !FilePath -> !FilePath -> !FilePath -> !Int -> !FilePath -> Option
+ Program.Mighty.Config: Option :: !Int -> !String -> !Bool -> !String -> !String -> !FilePath -> !FilePath -> !Bool -> !FilePath -> !Int -> !Int -> !FilePath -> !FilePath -> !FilePath -> !Int -> !Int -> !Int -> !String -> !Maybe FilePath -> !Int -> !FilePath -> !FilePath -> !FilePath -> !Int -> Option
- Program.Mighty.Config: [opt_routing_file] :: Option -> !(Maybe FilePath)
+ Program.Mighty.Config: [opt_routing_file] :: Option -> !Maybe FilePath
Files
- Program/Mighty/Config.hs +4/−4
- conf/example.conf +2/−0
- mighttpd2.cabal +2/−3
- src/Server.hs +13/−8
Program/Mighty/Config.hs view
@@ -29,6 +29,7 @@ , opt_user = "root" , opt_group = "root" , opt_pid_file = "/var/run/mighty.pid"+ , opt_report_file = "/tmp/mighty_report" , opt_logging = True , opt_log_file = "/var/log/mighty" , opt_log_file_size = 16777216@@ -44,9 +45,8 @@ , opt_tls_port = 443 , opt_tls_cert_file = "cert.pem" , opt_tls_chain_files = "chain.pem"- , opt_tls_key_file = "key.pem"+ , opt_tls_key_file = "privkey.pem" , opt_service = 0- , opt_report_file = "/tmp/mighty_report" } data Option = Option {@@ -56,6 +56,7 @@ , opt_user :: !String , opt_group :: !String , opt_pid_file :: !FilePath+ , opt_report_file :: !FilePath , opt_logging :: !Bool , opt_log_file :: !FilePath , opt_log_file_size :: !Int@@ -73,7 +74,6 @@ , opt_tls_chain_files :: !FilePath , opt_tls_key_file :: !FilePath , opt_service :: !Int- , opt_report_file :: !FilePath } deriving (Eq,Show) ----------------------------------------------------------------@@ -92,6 +92,7 @@ , opt_user = get "User" opt_user , opt_group = get "Group" opt_group , opt_pid_file = get "Pid_File" opt_pid_file+ , opt_report_file = get "Report_File" opt_report_file , opt_logging = get "Logging" opt_logging , opt_log_file = get "Log_File" opt_log_file , opt_log_file_size = get "Log_File_Size" opt_log_file_size@@ -109,7 +110,6 @@ , opt_tls_chain_files = get "Tls_Chain_Files" opt_tls_chain_files , opt_tls_key_file = get "Tls_Key_File" opt_tls_key_file , opt_service = get "Service" opt_service- , opt_report_file = get "ReportFile" opt_report_file } where get k func = maybe (func def) fromConf $ lookup k conf
conf/example.conf view
@@ -8,6 +8,7 @@ # If available, "nobody" is much more secure for Group:. Group: root Pid_File: /var/run/mighty.pid+Report_File: /tmp/mighty_report Logging: Yes # Yes or No Log_File: /var/log/mighty # The directory must be writable by User: Log_File_Size: 16777216 # bytes@@ -16,6 +17,7 @@ Index_Cgi: index.cgi Status_File_Dir: /usr/local/share/mighty/status Connection_Timeout: 30 # seconds+Proxy_Timeout: 0 # seconds, 0 is default of http-client, ie 30 seconds Fd_Cache_Duration: 10 # seconds # Server_Name: Mighttpd/3.x.y Tls_Port: 443
mighttpd2.cabal view
@@ -1,5 +1,5 @@ Name: mighttpd2-Version: 3.4.3+Version: 3.4.4 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3@@ -33,7 +33,7 @@ Program.Mighty.Resource Program.Mighty.Route Program.Mighty.Signal- Build-Depends: base >= 4.0 && < 5+ Build-Depends: base >= 4.9 && < 5 , array , async , auto-update@@ -46,7 +46,6 @@ , filepath , http-date , http-types- , io-choice , network , parsec >= 3 , resourcet
src/Server.hs view
@@ -11,7 +11,7 @@ import Data.List (dropWhile, dropWhileEnd, break) #endif import Data.Streaming.Network (bindPortTCP)-import Network (Socket, sClose)+import Network.Socket (Socket, close) import qualified Network.HTTP.Client as H import Network.Wai.Application.Classic hiding ((</>)) import Network.Wai.Handler.Warp@@ -218,17 +218,17 @@ openService opt | service == 1 = do s <- bindPortTCP httpsPort hostpref- debugMessage $ "HTTP/TLS service on port " ++ show httpsPort ++ "."+ debugMessage $ urlForHTTPS httpsPort return $ HttpsOnly s | service == 2 = do s1 <- bindPortTCP httpPort hostpref s2 <- bindPortTCP httpsPort hostpref- debugMessage $ "HTTP service on port " ++ show httpPort ++ " and "- ++ "HTTP/TLS service on port " ++ show httpsPort ++ "."+ debugMessage $ urlForHTTP httpPort+ debugMessage $ urlForHTTPS httpsPort return $ HttpAndHttps s1 s2 | otherwise = do s <- bindPortTCP httpPort hostpref- debugMessage $ "HTTP service on port " ++ show httpPort ++ "."+ debugMessage $ urlForHTTP httpPort return $ HttpOnly s where httpPort = opt_port opt@@ -239,13 +239,18 @@ debugMessage msg = when debug $ do putStrLn msg hFlush stdout+ urlForHTTP 80 = "http://localhost/"+ urlForHTTP p = "http://localhost:" ++ show p ++ "/"+ urlForHTTPS 443 = "https://localhost/"+ urlForHTTPS p = "https://localhost:" ++ show p ++ "/" + ---------------------------------------------------------------- closeService :: Service -> IO ()-closeService (HttpOnly s) = sClose s-closeService (HttpsOnly s) = sClose s-closeService (HttpAndHttps s1 s2) = sClose s1 >> sClose s2+closeService (HttpOnly s) = close s+closeService (HttpsOnly s) = close s+closeService (HttpAndHttps s1 s2) = close s1 >> close s2 ----------------------------------------------------------------