Package twisted :: Package protocols :: Module http |
[show private | hide private]
[frames | no frames]

## Module twisted.protocols.http

HyperText Transfer Protocol implementation.

This is used by twisted.web.

API Stability: Server HTTP support is semi-stable, client HTTP is unstable.

Future Plans:

- HTTP client support will at some point be refactored to support HTTP/1.1.
- Accept chunked data from clients in server.
- Other missing HTTP features from the RFC.

Maintainer: Itamar Shtull-Trauring<mailto:twisted@itamarst.org>

Classes
`HTTPChannel` | A receiver for HTTP requests.
`HTTPClient` | A client for HTTP 1.0
`HTTPFactory` | Factory for HTTP server.
`Request` | A HTTP request.
`StringTransport` | I am a StringIO wrapper that conforms for the transport API.

Function Summary
| ``datetimeToLogString`(msSinceEpoch)` Convert seconds since epoch to log datetime string.
| ``datetimeToString`(msSinceEpoch)` Convert seconds since epoch to HTTP datetime string.
| ``fromChunk`(data)` Convert chunk to string.
| ``stringToDatetime`(dateString)` Convert an HTTP date string to seconds since epoch.
| ``timegm`(year, month, day, hour, minute, second)` Convert time tuple in GMT to seconds since epoch, GMT
| ``toChunk`(data)` Convert string to a chunk.
| `_logDateTimeStart()`
| `_logDateTimeStop()`
| `_resetLogDateTime()`

Variable Summary
`int` | `ACCEPTED`
`int` | `BAD_GATEWAY`
`int` | `BAD_REQUEST`
`str` | `CACHED`
`int` | `CONFLICT`
`int` | `CREATED`
`int` | `EXPECTATION_FAILED`
`int` | `FORBIDDEN`
`int` | `FOUND`
`int` | `GATEWAY_TIMEOUT`
`int` | `GONE`
`int` | `HTTP_VERSION_NOT_SUPPORTED`
`int` | `INSUFFICIENT_STORAGE_SPACE`
`int` | `INTERNAL_SERVER_ERROR`
`int` | `LENGTH_REQUIRED`
`list` | `monthname`
`int` | `MOVED_PERMANENTLY`
`int` | `MULTI_STATUS`
`int` | `MULTIPLE_CHOICE`
`tuple` | `NO_BODY_CODES`
`int` | `NO_CONTENT`
`int` | `NON_AUTHORITATIVE_INFORMATION`
`int` | `NOT_ACCEPTABLE`
`int` | `NOT_ALLOWED`
`int` | `NOT_EXTENDED`
`int` | `NOT_FOUND`
`int` | `NOT_IMPLEMENTED`
`int` | `NOT_MODIFIED`
`int` | `OK`
`int` | `PARTIAL_CONTENT`
`int` | `PAYMENT_REQUIRED`
`int` | `PRECONDITION_FAILED`
`str` | `protocol_version`
`int` | `PROXY_AUTH_REQUIRED`
`SelectReactor` | `reactor`
`int` | `REQUEST_ENTITY_TOO_LARGE`
`int` | `REQUEST_TIMEOUT`
`int` | `REQUEST_URI_TOO_LONG`
`int` | `REQUESTED_RANGE_NOT_SATISFIABLE`
`int` | `RESET_CONTENT`
`dict` | `responses`
`dict` | `RESPONSES`
`int` | `SEE_OTHER`
`int` | `SERVICE_UNAVAILABLE`
`int` | `SWITCHING`
`int` | `TEMPORARY_REDIRECT`
`int` | `UNAUTHORIZED`
`int` | `UNSUPPORTED_MEDIA_TYPE`
`int` | `USE_PROXY`
`list` | `weekdayname`
`int` | `_CONTINUE`
`NoneType` | `_logDateTime`
`int` | `_logDateTimeUsers`
`NoneType` | `_resetLogDateTimeID`

Function Details

### datetimeToLogString(msSinceEpoch=None) Convert seconds since epoch to log datetime string.

### datetimeToString(msSinceEpoch=None) Convert seconds since epoch to HTTP datetime string.

### fromChunk(data) Convert chunk to string. Returns tuple (result, remaining), may raise ValueError.

### stringToDatetime(dateString) Convert an HTTP date string to seconds since epoch.

### timegm(year, month, day, hour, minute, second) Convert time tuple in GMT to seconds since epoch, GMT

### toChunk(data) Convert string to a chunk.

Variable Details

    ### ACCEPTED Type: `int` Value:
        202

    ### BAD_GATEWAY Type: `int` Value:
        502

    ### BAD_REQUEST Type: `int` Value:
        400

    ### CACHED Type: `str` Value:
        '''Magic constant returned by http.Request methods to set cache
        validation headers when the request is conditional and the value fails
        the condition.'''

    ### CONFLICT Type: `int` Value:
        409

    ### CREATED Type: `int` Value:
        201

    ### EXPECTATION_FAILED Type: `int` Value:
        417

    ### FORBIDDEN Type: `int` Value:
        403

    ### FOUND Type: `int` Value:
        302

    ### GATEWAY_TIMEOUT Type: `int` Value:
        504

    ### GONE Type: `int` Value:
        410

    ### HTTP_VERSION_NOT_SUPPORTED Type: `int` Value:
        505

    ### INSUFFICIENT_STORAGE_SPACE Type: `int` Value:
        507

    ### INTERNAL_SERVER_ERROR Type: `int` Value:
        500

    ### LENGTH_REQUIRED Type: `int` Value:
        411

    ### monthname Type: `list` Value:
        [None,
         'Jan',
         'Feb',
         'Mar',
         'Apr',
         'May',
         'Jun',
         'Jul',
        ...

    ### MOVED_PERMANENTLY Type: `int` Value:
        301

    ### MULTI_STATUS Type: `int` Value:
        207

    ### MULTIPLE_CHOICE Type: `int` Value:
        300

    ### NO_BODY_CODES Type: `tuple` Value:
        (204, 304)

    ### NO_CONTENT Type: `int` Value:
        204

    ### NON_AUTHORITATIVE_INFORMATION Type: `int` Value:
        203

    ### NOT_ACCEPTABLE Type: `int` Value:
        406

    ### NOT_ALLOWED Type: `int` Value:
        405

    ### NOT_EXTENDED Type: `int` Value:
        510

    ### NOT_FOUND Type: `int` Value:
        404

    ### NOT_IMPLEMENTED Type: `int` Value:
        501

    ### NOT_MODIFIED Type: `int` Value:
        304

    ### OK Type: `int` Value:
        200

    ### PARTIAL_CONTENT Type: `int` Value:
        206

    ### PAYMENT_REQUIRED Type: `int` Value:
        402

    ### PRECONDITION_FAILED Type: `int` Value:
        412

    ### protocol_version Type: `str` Value:
        'HTTP/1.1'

    ### PROXY_AUTH_REQUIRED Type: `int` Value:
        407

    ### reactor Type: `SelectReactor` Value:
        <twisted.internet.default.SelectReactor instance at 0x82e8c8c>

    ### REQUEST_ENTITY_TOO_LARGE Type: `int` Value:
        413

    ### REQUEST_TIMEOUT Type: `int` Value:
        408

    ### REQUEST_URI_TOO_LONG Type: `int` Value:
        414

    ### REQUESTED_RANGE_NOT_SATISFIABLE Type: `int` Value:
        416

    ### RESET_CONTENT Type: `int` Value:
        205

    ### responses Type: `dict` Value:
        {100: 'Continue',
         101: 'Switching Protocols',
         200: 'OK',
         201: 'Created',
         202: 'Accepted',
         203: 'Non-Authoritative Information',
         204: 'No Content',
         205: 'Reset Content.',
        ...

    ### RESPONSES Type: `dict` Value:
        {100: 'Continue',
         101: 'Switching Protocols',
         200: 'OK',
         201: 'Created',
         202: 'Accepted',
         203: 'Non-Authoritative Information',
         204: 'No Content',
         205: 'Reset Content.',
        ...

    ### SEE_OTHER Type: `int` Value:
        303

    ### SERVICE_UNAVAILABLE Type: `int` Value:
        503

    ### SWITCHING Type: `int` Value:
        101

    ### TEMPORARY_REDIRECT Type: `int` Value:
        307

    ### UNAUTHORIZED Type: `int` Value:
        401

    ### UNSUPPORTED_MEDIA_TYPE Type: `int` Value:
        415

    ### USE_PROXY Type: `int` Value:
        305

    ### weekdayname Type: `list` Value:
        ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']

    ### _CONTINUE Type: `int` Value:
        100

    ### _logDateTime Type: `NoneType` Value:
        None

    ### _logDateTimeUsers Type: `int` Value:
        0

    ### _resetLogDateTimeID Type: `NoneType` Value:
        None

Generated by Epydoc 1.1 on Thu May 8 13:18:46 2003 | http://epydoc.sf.net