packages feed

hack-contrib 2009.4.52.1 → 2009.4.52.2

raw patch · 5 files changed

+27/−29 lines, 5 filesdep −happstack-server

Dependencies removed: happstack-server

Files

changelog.md view
@@ -1,4 +1,12 @@+2009.4.52.2+-----------++### Fix++* use cgi helpers, less dependency+ 2009.4.52.1+-----------  ### Feature 
hack-contrib.cabal view
@@ -1,5 +1,5 @@ Name:                 hack-contrib-Version:              2009.4.52.1+Version:              2009.4.52.2 Build-type:           Simple Synopsis:             Hack contrib Description:          Hack contrib@@ -15,7 +15,7 @@  library   ghc-options: -Wall-  build-depends: base, cgi, network, haskell98, old-locale, old-time, directory, filepath, containers, bytestring, ansi-wl-pprint, mps >= 2009.4.50, data-default >= 0.2, ansi-wl-pprint, unix, time, pureMD5, hack >= 2009.4.52, happstack-server >= 0.2+  build-depends: base, cgi, network, haskell98, old-locale, old-time, directory, filepath, containers, bytestring, ansi-wl-pprint, mps >= 2009.4.50, data-default >= 0.2, ansi-wl-pprint, unix, time, pureMD5, hack >= 2009.4.52   hs-source-dirs: src/   exposed-modules:                       Hack.Contrib.Utils
src/Hack/Contrib/Middleware/ShowStatus.hs view
@@ -35,7 +35,7 @@       let            i       = response.status           message = i.show_status_message .fromMaybe (i.show)-          detail  = env.custom_"hack.showstatus.detail" .fromMaybe message+          detail  = env.custom.get "hack.showstatus.detail" .fromMaybe message           result  = template message detail env response           size    = result.bytesize       in
src/Hack/Contrib/Request.hs view
@@ -13,8 +13,8 @@ import Network.CGI.Cookie import Data.ByteString.Lazy.Char8 (pack, unpack) -import qualified Happstack.Server.MessageWrap as HM-import qualified Happstack.Server.HTTP.Types as HT+-- import qualified Happstack.Server.MessageWrap as HM+-- import qualified Happstack.Server.HTTP.Types as HT  body :: Env -> String body = hack_input@@ -29,7 +29,7 @@ path env = env.script_name ++ env.path_info  content_type :: Env -> String-content_type env = env.http_ _ContentType .fromMaybe ""+content_type env = env.http.get _ContentType .fromMaybe ""  media_type :: Env -> String media_type env = env.content_type.split "\\s*[;,]\\s*" .first.lower@@ -51,7 +51,7 @@ content_charset env = env.media_type_params.lookup "charset" .fromMaybe ""  host :: Env -> String-host env = env.http_ _Host .fromMaybe (env.server_name) .gsub ":\\d+\\z" ""+host env = env.http.get _Host .fromMaybe (env.server_name) .gsub ":\\d+\\z" ""  params :: Env -> [(String, String)] params env =@@ -61,29 +61,26 @@  inputs :: Env -> [(String, String)] inputs env = -  case env.media_type of -    "application/x-www-form-urlencoded" -> env.body.formDecode-    "multipart/form-data" -> -      env-        .body-        .pack-        .HM.multipartDecode (env.media_type_params)-        .concatMap to_headers-    otherwise -> []-  +  env+    .http+    .map_fst (upper > gsub "-" "_") -- cgi env use all cap letters+    .(("REQUEST_METHOD", env.request_method.show) : ) -- for cgi request+    .flip decodeInput (env.body.pack)+    .fst+    .concatMap to_headers   where-    to_headers (k, input) = case input.HT.inputFilename of-      Nothing -> [(k, input.HT.inputValue.unpack)]+    to_headers (k, input) = case input.inputFilename of+      Nothing -> [(k, input.inputValue.unpack)]       Just name -> -        [  (k, input.HT.inputValue.unpack)+        [  (k, input.inputValue.unpack)         ,  ("hack_input_file_name_" ++ k, name)         ]  referer :: Env -> String-referer = http_ _Referer > fromMaybe "/"+referer = http > get _Referer > fromMaybe "/"  cookies :: Env -> [(String, String)]-cookies env = case env.http_ _Cookie of+cookies env = case env.http.get _Cookie of   Nothing -> []   Just s -> s.readCookies @@ -93,14 +90,8 @@     then env.path      else env.path ++ "?" ++ env.query_string -http_ :: String -> Env -> Maybe String-http_ s env = env.http.get s- set_http :: String -> String -> Env -> Env set_http k v env = env {http = env.http.put k v}--custom_ :: String -> Env -> Maybe String-custom_ s env = env.custom.get s  set_custom :: String -> String -> Env -> Env set_custom k v env = env {custom = env.custom.put k v}
src/Hack/Contrib/Utils.hs view
@@ -18,7 +18,6 @@ import Control.Monad (mplus, MonadPlus) import Data.Maybe import System.IO-import System.Locale import System.FilePath ((</>)) import Control.Category (Category) import Data.List (lookup)