hack-handler-evhttp 2009.8.2 → 2009.8.4
raw patch · 3 files changed
+12/−5 lines, 3 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Hack/Handler/EvHTTP.hsc +7/−4
- Setup.hs +4/−0
- hack-handler-evhttp.cabal +1/−1
Hack/Handler/EvHTTP.hsc view
@@ -10,6 +10,7 @@ import Control.Concurrent import Control.Concurrent.Chan+import qualified Data.ByteString as BS import Control.Monad import Data.ByteString.Class@@ -269,8 +270,9 @@ inputBufferP <- ((#peek struct evhttp_request, input_buffer) reqP :: IO BufPtr) bufP <- ((#peek struct evbuffer, buffer) inputBufferP :: IO CString) off <- fmap fromIntegral $ ((#peek struct evbuffer, off) inputBufferP :: IO CSize)- fmap toLazyByteString $ peekCStringLen (bufP, off)+ fmap toLazyByteString $ BS.packCStringLen (bufP, off) +-- Start sending the response sendResponse :: ReqPtr -> Response -> IO () sendResponse reqP response = do forM_ (headers response) $ \(key, val) -> do@@ -278,10 +280,11 @@ withCString val $ \v' -> do outHeadersP <- (#peek struct evhttp_request, output_headers) reqP addHeader outHeadersP k' v'- let body' = (fromLazyByteString $ body response)- withCString body' $ \bodyBytes -> do+ let body' = toStrictByteString $ body response+ let bodyLength = fromIntegral $ BS.length body'+ BS.useAsCString (toStrictByteString $ body response) $ \bodyBytes -> do buf <- bufNew- bufAdd buf bodyBytes $ fromIntegral . length $ body'+ bufAdd buf bodyBytes bodyLength let msg = statusMessage $ status response let code = fromIntegral $ status response withCString msg $ \msg' -> do
Setup.hs view
@@ -1,2 +1,6 @@+#!/usr/bin/env /usr/bin/runhaskell import Distribution.Simple+ main = defaultMain++
hack-handler-evhttp.cabal view
@@ -1,5 +1,5 @@ Name: hack-handler-evhttp-Version: 2009.8.2+Version: 2009.8.4 Build-type: Simple Synopsis: Hack EvHTTP (libevent) Handler Description: Hack EvHTTP (libevent) Handler