Part of twisted.web2 View Source
Function | dashCapitalize | Capitalize a string, making sure to treat - as a word seperator |
Function | casemappingify | Undocumented |
Function | lowerify | Undocumented |
Class | HeaderHandler | HeaderHandler manages header generating and parsing functions. |
Function | parseDateTime | Convert an HTTP date string (one of three formats) to seconds since epoch. |
Class | Token | Undocumented |
Function | tokenize | Tokenize a string according to normal HTTP header parsing rules. |
Function | split | The same as str.split but works on arbitrary sequences. |
Function | filterTokens | Filter out instances of Token, leaving only a list of strings. |
Function | checkSingleToken | Undocumented |
Function | parseKeyValue | Undocumented |
Function | parseArgs | Undocumented |
Function | listParser | Return a function which applies 'fun' to every element in the |
Function | last | Return seq[-1] |
Function | quoteString | Quote a string according to the rules for the quoted-string production |
Function | listGenerator | Return a function which applies 'fun' to every element in |
Function | generateList | Undocumented |
Function | singleHeader | Undocumented |
Function | generateKeyValues | Format an iterable of key/value pairs. |
Class | MimeType | No class docstring; 1/1 class methods, 1/5 methods documented |
Function | parseAccept | Undocumented |
Function | parseAcceptQvalue | Undocumented |
Function | addDefaultCharset | Undocumented |
Function | addDefaultEncoding | Undocumented |
Function | parseContentType | Undocumented |
Function | parseContentMD5 | Undocumented |
Function | parseContentRange | Parse a content-range header into (kind, start, end, realLength). |
Function | parseExpect | Undocumented |
Function | parseExpires | Undocumented |
Function | parseIfModifiedSince | Undocumented |
Function | parseIfRange | Undocumented |
Function | parseRange | Undocumented |
Function | parseRetryAfter | Undocumented |
Function | parseWWWAuthenticate | Undocumented |
Function | parseAuthorization | Undocumented |
Function | generateAccept | Undocumented |
Function | removeDefaultEncoding | Undocumented |
Function | generateAcceptQvalue | Undocumented |
Function | parseCacheControl | Undocumented |
Function | generateCacheControl | Undocumented |
Function | generateContentRange | tup is (type, start, end, len) |
Function | generateDateTime | Convert seconds since epoch to HTTP datetime string. |
Function | generateExpect | Undocumented |
Function | generateRange | Undocumented |
Function | generateRetryAfter | Undocumented |
Function | generateContentType | Undocumented |
Function | generateIfRange | Undocumented |
Function | generateWWWAuthenticate | Undocumented |
Function | generateAuthorization | Undocumented |
Class | ETag | Undocumented |
Function | parseStarOrETag | Undocumented |
Function | generateStarOrETag | Undocumented |
Class | Cookie | Undocumented |
Function | parseCookie | Bleargh, the cookie spec sucks. |
Function | generateCookie | Undocumented |
Function | parseSetCookie | Undocumented |
Function | parseSetCookie2 | Undocumented |
Function | makeCookieFromList | Undocumented |
Function | generateSetCookie | Undocumented |
Function | generateSetCookie2 | Undocumented |
Function | parseDepth | Undocumented |
Function | parseOverWrite | Undocumented |
Function | generateOverWrite | Undocumented |
Class | Headers | This class stores the HTTP headers as both a parsed representation |
Class | __RecalcNeeded | Undocumented |
In particular:
NOTE: not all headers can be parsed with this function.
Takes a raw header value (list of strings), and Returns a generator of strings and Token class instances.
Used instead of a more specific parsing method (e.g. splitting on commas) when only strings are expected, so as to be a little lenient.
Apache does it this way and has some comments about broken clients which forget commas (?), so I'm doing it the same way. It shouldn't hurt anything, in any case.
Parameters | s | (type: str
) |
Returns | (type: str
) |
Although each header in HTTP 1.1 redefines the grammar for the formatting of its parameters, the grammar defined by almost all headers conforms to the specification given in RFC 2046. Note also that RFC 2616 section 19.2 note 2 points out that many implementations fail if the value is quoted, therefore this function only quotes the value when it is necessary.
Parameters | parameters | An iterable of tuple of a str parameter name and
str or None parameter value which will be
formated.
|
Returns | The formatted result.
(type: str
) |
realLength might be None if real length is not known ('*'). start and end might be None if start,end unspecified (for response code 416)