Portability | portable |
---|---|
Stability | Stable |
Maintainer | Michael Snoyman <michael@snoyman.com> |
Various web encodings.
- encodeUrl :: StringLike s => s -> s
- decodeUrl :: StringLike s => s -> s
- encodeHtml :: StringLike s => s -> s
- decodeHtml :: StringLike s => s -> s
- encodeJson :: StringLike s => s -> s
- decodeJson :: StringLike s => s -> s
- encodeUrlPairs :: StringLike s => [(s, s)] -> s
- decodeUrlPairs :: StringLike s => s -> [(s, s)]
- data FileInfo s c = FileInfo {
- fileName :: s
- fileContentType :: s
- fileContent :: c
- parseMultipart :: StringLike s => String -> s -> ([(s, s)], [(s, FileInfo s s)])
- parsePost :: StringLike s => String -> String -> s -> ([(s, s)], [(s, FileInfo s s)])
- decodeCookies :: StringLike s => s -> [(s, s)]
- parseCookies :: StringLike s => s -> [(s, s)]
- parseHttpAccept :: StringLike s => s -> [s]
- formatW3 :: UTCTime -> String
Simple encodings.
URL (percentage encoding)
encodeUrl :: StringLike s => s -> sSource
Encode all but unreserved characters with percentage encoding.
Assumes use of UTF-8 character encoding.
decodeUrl :: StringLike s => s -> sSource
Decode percentage encoding. Assumes use of UTF-8 character encoding.
HTML (entity encoding)
encodeHtml :: StringLike s => s -> sSource
Escape special HTML characters.
decodeHtml :: StringLike s => s -> sSource
Decode HTML-encoded content into plain content.
Note: this does not support all HTML entities available. It also swallows all failures.
JSON
encodeJson :: StringLike s => s -> sSource
Perform JSON-encoding on a string. Does not wrap in quotation marks. Taken from json package by Sigbjorn Finne.
decodeJson :: StringLike s => s -> sSource
HTTP level encoding.
Query string- pairs of percentage encoding
encodeUrlPairs :: StringLike s => [(s, s)] -> sSource
Convert a list of key-values pairs into a query string. Does not include the question mark at the beginning.
decodeUrlPairs :: StringLike s => s -> [(s, s)]Source
Convert into key-value pairs. Strips the leading ? if necesary.
Post parameters
Information on an uploaded file.
FileInfo | |
|
:: StringLike s | |
=> String | boundary |
-> s | content |
-> ([(s, s)], [(s, FileInfo s s)]) |
Parse a multipart form into parameters and files.
:: StringLike s | |
=> String | content type |
-> String | content length |
-> s | body of the post |
-> ([(s, s)], [(s, FileInfo s s)]) |
Parse a post request. This function determines the correct decoding function to use.
Specific HTTP headers
decodeCookies :: StringLike s => s -> [(s, s)]Source
Deprecate alias for parseCookies
.
parseCookies :: StringLike s => s -> [(s, s)]Source
Decode the value of an HTTP_COOKIE header into key/value pairs.
parseHttpAccept :: StringLike s => s -> [s]Source
Parse the HTTP accept string to determine supported content types.