t.w.http : module documentation

Part of twisted.web View Source

HyperText Transfer Protocol implementation.

This is the basic server-side protocol implementation used by the Twisted Web server. It can parse HTTP 1.0 requests and supports many HTTP 1.1 features as well. Additionally, some functionality implemented here is also useful for HTTP clients (such as the chunked encoding parser).

Function unquote Undocumented
Function urlparse Parse an URL into six components.
Function parse_qs Like cgi.parse_qs, but with support for parsing byte strings on Python 3.
Function datetimeToString Convert seconds since epoch to HTTP datetime string.
Function datetimeToLogString Convert seconds since epoch to log datetime string.
Function timegm Convert time tuple in GMT to seconds since epoch, GMT
Function stringToDatetime Convert an HTTP date string (one of three formats) to seconds since epoch.
Function toChunk Convert string to a chunk.
Function fromChunk Convert chunk to string.
Function parseContentRange Parse a content-range header into (start, end, realLength).
Class StringTransport I am a StringIO wrapper that conforms for the transport API. I support the `writeSequence' method.
Class HTTPClient A client for HTTP 1.0.
Class Request A HTTP request.
Class PotentialDataLoss No summary
Class HTTPChannel A receiver for HTTP requests.
Function combinedLogFormatter
Function proxiedLogFormatter
Class HTTPFactory Factory for HTTP server.
Function _parseHeader Undocumented
Class _DataLoss No summary
Class _MalformedChunkedDataError No summary
Class _IdentityTransferDecoder Protocol for accumulating bytes up to a specified length. This handles the case where no Transfer-Encoding is specified.
Class _ChunkedTransferDecoder No summary
Function _escape Return a string like python repr, but always escaped as if surrounding quotes were double quotes.
Class _XForwardedForRequest Add a layer on top of another request that only uses the value of an X-Forwarded-For header as the result of getClientIP.
def unquote(string, *args, **kwargs): (source)
Undocumented
def _parseHeader(line): (source)
Undocumented
def urlparse(url): (source)
Parse an URL into six components.

This is similar to urlparse.urlparse, but rejects unicode input and always produces bytes output.

ReturnsThe scheme, net location, path, params, query string, and fragment of the URL - all as bytes. (type: ParseResultBytes)
RaisesTypeErrorThe given url was a unicode string instead of a bytes.
def parse_qs(qs, keep_blank_values=0, strict_parsing=0): (source)
Like cgi.parse_qs, but with support for parsing byte strings on Python 3.
def datetimeToString(msSinceEpoch=None): (source)
Convert seconds since epoch to HTTP datetime string.
Returns (type: bytes)
def datetimeToLogString(msSinceEpoch=None): (source)
Convert seconds since epoch to log datetime string.
Returns (type: str)
def timegm(year, month, day, hour, minute, second): (source)
Convert time tuple in GMT to seconds since epoch, GMT
def stringToDatetime(dateString): (source)
Convert an HTTP date string (one of three formats) to seconds since epoch.
def toChunk(data): (source)
Convert string to a chunk.
Returnsa tuple of bytes representing the chunked encoding of data
def fromChunk(data): (source)
Convert chunk to string.
Returnstuple of (result, remaining) - both bytes.
RaisesValueErrorIf the given data is not a correctly formatted chunked byte string.
def parseContentRange(header): (source)
Parse a content-range header into (start, end, realLength).

realLength might be None if real length is not known ('*').

def _escape(s): (source)
Return a string like python repr, but always escaped as if surrounding quotes were double quotes.
ParameterssThe string to escape. (type: bytes or unicode)
ReturnsAn escaped string. (type: unicode)
@provider(IAccessLogFormatter)
def combinedLogFormatter(timestamp, request): (source)
ReturnsA combined log formatted log line for the given request.
See AlsoIAccessLogFormatter
@provider(IAccessLogFormatter)
def proxiedLogFormatter(timestamp, request): (source)
ReturnsA combined log formatted log line for the given request but use the value of the X-Forwarded-For header as the value for the client IP address.
See AlsoIAccessLogFormatter
API Documentation for Twisted, generated by pydoctor at 2014-05-12 18:27:00.