Hoogle Search

Within LTS Haskell 24.45 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. rspTransformingRqBody :: Response -> !Bool

    snap-core Snap.Internal.Core

    If true, we are transforming the request body with transformRequestBody

  2. transformRequestBody :: (InputStream ByteString -> IO (InputStream ByteString)) -> Snap ()

    snap-core Snap.Internal.Core

    Normally Snap is careful to ensure that the request body is fully consumed after your web handler runs, but before the Response body is streamed out the socket. If you want to transform the request body into some output in O(1) space, you should use this function. Take care: in order for this to work, the HTTP client must be written with input-to-output streaming in mind. Note that upon calling this function, response processing finishes early as if you called finishWith. Make sure you set any content types, headers, cookies, etc. before you call this function. Example:

    ghci> :set -XOverloadedStrings
    ghci> import qualified Data.ByteString.Char8 as B8
    ghci> import Data.Char (toUpper)
    ghci> import qualified Data.Map as M
    ghci> import qualified Snap.Test as T
    ghci> import qualified System.IO.Streams as Streams
    ghci> let r = T.put "/foo" "text/plain" "some text"
    ghci> let f = Streams.map (B8.map toUpper)
    ghci> T.runHandler r (transformRequestBody f >> readRequestBody 2048 >>= writeLBS)
    HTTP/1.1 200 OK
    server: Snap/test
    date: Thu, 07 Aug 2014 20:30:15 GMT
    
    SOME TEXT
    

  3. c_format_http_time :: CTime -> CString -> IO ()

    snap-core Snap.Internal.Http.Types

    No documentation available.

  4. c_format_log_time :: CTime -> CString -> IO ()

    snap-core Snap.Internal.Http.Types

    No documentation available.

  5. rspTransformingRqBody :: Response -> !Bool

    snap-core Snap.Internal.Http.Types

    If true, we are transforming the request body with transformRequestBody

  6. DispositionFormData :: PartDisposition

    snap-core Snap.Util.FileUploads

    Content-Disposition: form-data.

  7. doProcessFormInputs :: UploadPolicy -> Bool

    snap-core Snap.Util.FileUploads

    Does this upload policy stipulate that we want to treat parts without filenames as form input?

  8. getMaximumFormInputSize :: UploadPolicy -> Int64

    snap-core Snap.Util.FileUploads

    Get the maximum size of a form input which will be read into our rqParams map.

  9. getMaximumNumberOfFormInputs :: UploadPolicy -> Int

    snap-core Snap.Util.FileUploads

    Get the maximum size of a form input which will be read into our rqParams map.

  10. handleFormUploads :: MonadSnap m => UploadPolicy -> FileUploadPolicy -> (PartInfo -> InputStream ByteString -> IO a) -> m ([FormParam], [FormFile a])

    snap-core Snap.Util.FileUploads

    Processes form data and calls provided storage function on file parts. You can use this together with withTemporaryStore, storeAsLazyByteString or provide your own callback to store uploaded files. If you need to process uploaded file mime type or file name, do it in the store callback function. See also foldMultipart. Example using with small files which can safely be stored in memory.

    import qualified Data.ByteString.Lazy as Lazy
    
    handleSmallFiles :: MonadSnap m => [(ByteString, ByteString, Lazy.ByteString)]
    handleSmallFiles = handleFormUploads uploadPolicy filePolicy store
    
    where
    uploadPolicy = defaultUploadPolicy
    filePolicy = setMaximumFileSize (64*1024)
    $ setMaximumNumberOfFiles 5
    defaultUploadPolicy
    store partInfo stream = do
    content <- storeAsLazyByteString partInfo stream
    let
    fileName = partFileName partInfo
    fileMime = partContentType partInfo
    in (fileName, fileMime, content)
    

Page 583 of many | Previous | Next