Package cherrypy :: Package lib :: Module http
[hide private]
[frames] | no frames]

Module http

source code

HTTP library functions.

Classes [hide private]
  HeaderElement
An element (with parameters) from an HTTP header's element list.
  AcceptElement
An element (with parameters) from an Accept-* header's element list.
  CaseInsensitiveDict
A case-insensitive dict subclass.
  HeaderMap
A dict subclass for HTTP request and response headers.
  MaxSizeExceeded
  SizeCheckWrapper
Wraps a file-like object, raising MaxSizeExceeded if too large.
  Host
An internet address.
Functions [hide private]
 
urljoin(*atoms) source code
 
protocol_from_http(protocol_str)
Return a protocol tuple from the given 'HTTP/x.y' string.
source code
 
get_ranges(headervalue, content_length)
Return a list of (start, stop) indices from a Range header, or None.
source code
 
header_elements(fieldname, fieldvalue)
Return a HeaderElement list from a comma-separated header str.
source code
 
decode_TEXT(value)
Decode RFC-2047 TEXT (e.g.
source code
 
valid_status(status)
Return legal HTTP status Code, Reason-phrase and Message.
source code
 
parse_query_string(query_string, keep_blank_values=True)
Build a params dictionary from a query_string.
source code
 
params_from_CGI_form(form) source code
Variables [hide private]
  response_codes = {100: ('Continue', 'Request received, please ...
  q_separator = re.compile(r'; *q *=')
  image_map_pattern = re.compile(r'[0-9]+,[0-9]+')
Function Details [hide private]

get_ranges(headervalue, content_length)

source code 

Return a list of (start, stop) indices from a Range header, or None.

Each (start, stop) tuple will be composed of two ints, which are suitable for use in a slicing operation. That is, the header "Range: bytes=3-6", if applied against a Python string, is requesting resource[3:7]. This function will return the list [(3, 7)].

If this function return an empty list, you should return HTTP 416.

decode_TEXT(value)

source code 
Decode RFC-2047 TEXT (e.g. "=?utf-8?q?f=C3=BCr?=" -> u"für").

valid_status(status)

source code 

Return legal HTTP status Code, Reason-phrase and Message.

The status arg must be an int, or a str that begins with an int.

If status is an int, or a str and no reason-phrase is supplied, a default reason-phrase will be provided.

Variables Details [hide private]

response_codes

Value:
{100: ('Continue', 'Request received, please continue'),
 101: ('Switching Protocols',
       'Switching to new protocol; obey Upgrade header'),
 200: ('OK', 'Request fulfilled, document follows'),
 201: ('Created', 'Document created, URL follows'),
 202: ('Accepted', 'Request accepted, processing continues off-line'),
 203: ('Non-Authoritative Information',
       'Request fulfilled from cache'),
...