Modulesnap-core-1.0.5.1Haskell2010
Snap.Internal.Parsing
Synopsis
- value fullyParse
- value <?>
- value fullyParse'
- value parseNum
- value untilEOL
- value crlf
- value toTableList
- value toTable
- value skipFieldChars
- value isFieldChar
- value pHeaders
- value pWord
- value pWord'
- value pQuotedString
- value pQuotedString'
- value isRFCText
- value matchAll
- value pAvPairs
- value pAvPair
- value pParameter
- value pParameter'
- value trim
- value pValueWithParameters
- value pValueWithParameters'
- value pContentTypeWithParameters
- value pToken
- value isToken
- value pTokens
- value parseToCompletion
- type DList
- value pUrlEscaped
- value urlDecode
- value urlEncode
- value urlEncodeBuilder
- value urlEncodeClean
- value hexd
- value finish
- value parseUrlEncoded
- value buildUrlEncoded
- value printUrlEncoded
- value pCookies
- value parseCookie
- value unsafeFromHex
- value unsafeFromNat
- Packagesnap-core-1.0.5.1
- Exports44
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceParsing.hs
Parser for request headers.
Used for "#field-name", and field-name = token, so "#token": comma-separated tokens/field-names, like a header field list.
Decode an URL-escaped string (see http://tools.ietf.org/html/rfc2396.html#section-2.4)
Example:
ghci> urlDecode "1+attoparsec+%7e%3d+3+*+10%5e-2+meters"
Just "1 attoparsec ~= 3 * 10^-2 meters"
URL-escape a string (see http://tools.ietf.org/html/rfc2396.html#section-2.4)
Example:
ghci> urlEncode "1 attoparsec ~= 3 * 10^-2 meters"
"1+attoparsec+%7e%3d+3+*+10%5e-2+meters"
URL-escape a string (see http://tools.ietf.org/html/rfc2396.html#section-2.4) into a Builder.
Example:
ghci> import Data.ByteString.Builder
ghci> toLazyByteString . urlEncodeBuilder $ "1 attoparsec ~= 3 * 10^-2 meters"
"1+attoparsec+%7e%3d+3+*+10%5e-2+meters"
Parse a string encoded in application/x-www-form-urlencoded format.
Example:
ghci> parseUrlEncoded "Name=John+Doe&Name=Jane+Doe&Age=23&Formula=a+%2B+b+%3D%3D+13%25%21"
Data.Map.fromList [(Age,["23"]),(Formula,["a + b == 13%!"]),(Name,["John Doe","Jane Doe"])]
Like printUrlEncoded, but produces a Builder instead of a ByteString. Useful for constructing a large string efficiently in a single step.
Example:
ghci> import Data.Map
ghci> import Data.Monoid
ghci> import Data.ByteString.Builder
ghci> let bldr = buildUrlEncoded (Data.Map.fromList [(Name, ["John Doe"]), (Age, ["23"])])
ghci> toLazyByteString $ byteString "http://example.com/script?" <> bldr
"http://example.com/script?Age=23&Name=John+Doe"
Given a collection of key-value pairs with possibly duplicate
keys (represented as a Map), construct a string in
application/x-www-form-urlencoded format.
Example:
ghci> printUrlEncoded (Data.Map.fromList [(Name, ["John Doe"]), (Age, ["23"])])
"Age=23&Name=John+Doe"