packages feed

hums 0.4.2 → 0.4.3

raw patch · 2 files changed

+16/−12 lines, 2 filesdep ~conduitdep ~http-typesdep ~unordered-containers

Dependency ranges changed: conduit, http-types, unordered-containers, wai, warp

Files

hums.cabal view
@@ -1,5 +1,5 @@ Name:                hums-Version:             0.4.2+Version:             0.4.3 Synopsis:            Haskell UPnP Media Server Description:         A simple UPnP Media Server.   .@@ -21,13 +21,13 @@   Build-Depends: base == 4.*                , blaze-builder >= 0.3 && <0.4                , bytestring >= 0.9.0.1-               , conduit >= 0.4 && <0.5+               , conduit >= 0.5 && <0.6                , ConfigFile >= 1.0.5                , containers >= 0.1.0.1                , directory >= 1.0.0.0                , filepath >= 1.1.0.0                , HaXml >= 1.22 && <1.23-               , http-types >= 0.6.9 && <0.7+               , http-types >= 0.7 && <0.8                , hxt >= 9.1 && < 9.2                , MissingH >= 1.0.1                , mtl == 2.0.*@@ -37,10 +37,10 @@                , text >= 0.11 && < 0.12                , transformers >= 0.2 && < 0.3                , unix >= 2.3.0.0-               , unordered-containers >= 0.1 && < 0.2+               , unordered-containers >= 0.2 && < 0.3                , case-insensitive >= 0.4 && < 0.5-               , wai >= 1.2 && < 1.3-               , warp >= 1.2 && < 1.3+               , wai >= 1.3 && < 1.4+               , warp >= 1.3 && < 1.4   Extensions:          Arrows                        GeneralizedNewtypeDeriving                        OverloadedStrings
src/Handlers.hs view
@@ -40,7 +40,8 @@ import           Data.Text (Text) import qualified Data.Text as T import           Data.Text.Encoding (encodeUtf8, decodeUtf8)-import           Network.HTTP.Types (Status, Header, partialContent206, forbidden403, notImplemented501, ok200, notFound404, headerContentType, headerContentLength, headerConnection)+import           Network.HTTP.Types (Status, Header, partialContent206, forbidden403, notImplemented501, ok200, notFound404)+import           Network.HTTP.Types.Header (hConnection, hContentLength, hContentType) import           Network.Wai (Application, Request, Response(..), requestBody, requestHeaders, responseLBS) import           System.FilePath import           System.IO (withFile, hFileSize, IOMode(..))@@ -92,7 +93,7 @@                 (CL.map $ Chunk . fromByteString)       return $ ResponseSource partialContent206                  [ hdrContentLength n-                 , headerContentType mimeType+                 , (hContentType, mimeType)                  , hdrContentRange l' h' fsz                  , hdrAcceptRangesBytes                  , hdrConnectionClose@@ -109,7 +110,7 @@   let xml = generateDescriptionXml c mc s   return $ responseLBS ok200 [ hdrConnectionClose                              , hdrContentLength (L.length xml)-                             , headerContentType "text/xml"+                             , xmlContentType                              ] xml  -- Handle static files.@@ -184,7 +185,7 @@ sendXml :: L.ByteString -> ResourceT IO Response sendXml xml = return $ responseLBS ok200 [ hdrConnectionClose                                          , hdrContentLength (L.length xml)-                                         , headerContentType "text/xml"+                                         , xmlContentType                                          ] xml  logMessage :: String -> ResourceT IO ()@@ -192,7 +193,7 @@  -- Convenience functions for DRY construction of headers. hdrConnectionClose :: Header-hdrConnectionClose = headerConnection "close"+hdrConnectionClose = (hConnection, "close")  hdrAcceptRangesBytes :: Header hdrAcceptRangesBytes = (CI.mk "accept-ranges", "bytes")@@ -201,9 +202,12 @@ hdrContentRange l h s = (CI.mk "content-range", B8.pack $ printf "%d-%d/%d" l h s)  hdrContentLength :: (Show a, Integral a) => a -> Header-hdrContentLength l = headerContentLength $ encodeUtf8 $ T.pack $ show l+hdrContentLength l = (hContentLength, encodeUtf8 $ T.pack $ show l)  -- Name of the range header. rangeHeader :: CI ByteString rangeHeader = CI.mk "range" +-- XML content type+xmlContentType :: Header+xmlContentType = (hContentType, "text/xml")