Portability | portable |
---|---|
Stability | Unstable |
Maintainer | Michael Snoyman <michael@snoyman.com> |
Various web encodings.
- encodeUrl :: (LazyByteString x, LazyByteString y) => x -> y
- decodeUrl :: (LazyByteString x, LazyByteString y) => x -> y
- encodeHtml :: String -> String
- encodeJson :: LazyByteString x => String -> x
- encodeUrlPairs :: (LazyByteString x, LazyByteString y, LazyByteString z) => [(x, y)] -> z
- decodeUrlPairs :: (LazyByteString x, LazyByteString y, LazyByteString z) => x -> [(y, z)]
- data FileInfo = FileInfo {}
- parseMultipart :: LazyByteString lbs => lbs -> ByteString -> ([(String, String)], [(String, FileInfo)])
- parsePost :: String -> String -> ByteString -> ([(String, String)], [(String, FileInfo)])
- decodeCookies :: String -> [(String, String)]
- formatW3 :: UTCTime -> String
Simple encodings.
URL (percentage encoding)
encodeUrl :: (LazyByteString x, LazyByteString y) => x -> ySource
Encode all but unreserved characters with percentage encoding.
Assumes use of UTF-8 character encoding.
decodeUrl :: (LazyByteString x, LazyByteString y) => x -> ySource
Decode percentage encoding. Assumes use of UTF-8 character encoding.
HTML (entity encoding)
encodeHtml :: String -> StringSource
Escape special HTML characters.
JSON
encodeJson :: LazyByteString x => String -> xSource
Perform JSON-encoding on a string. Does not wrap in quotation marks.
HTTP level encoding.
Query string- pairs of percentage encoding
encodeUrlPairs :: (LazyByteString x, LazyByteString y, LazyByteString z) => [(x, y)] -> zSource
Convert a list of key-values pairs into a query string. Does not include the question mark at the beginning.
decodeUrlPairs :: (LazyByteString x, LazyByteString y, LazyByteString z) => x -> [(y, z)]Source
Convert into key-value pairs. Strips the leading ? if necesary.
Post parameters
Information on an uploaded file.
:: LazyByteString lbs | |
=> lbs | boundary |
-> ByteString | content |
-> ([(String, String)], [(String, FileInfo)]) |
Parse a multipart form into parameters and files.
:: String | content type |
-> String | content length |
-> ByteString | body of the post |
-> ([(String, String)], [(String, FileInfo)]) |
Parse a post request. This function determines the correct decoding function to use.
Cookies
decodeCookies :: String -> [(String, String)]Source
Decode the value of an HTTP_COOKIE header into key/value pairs.