Package circuits :: Package web :: Module http :: Class HTTP

Class HTTP

    object --+            
             |            
  core.Manager --+        
                 |        
core.BaseComponent --+    
                     |    
        core.Component --+
                         |
                        HTTP

HTTP Protocol Component

Implements the HTTP server protocol and parses and processes incoming HTTP messages creating and sending an appropriate response.

Nested Classes

Inherited from core.Component: __metaclass__

Instance Methods
 
__init__(self, *args, **kwargs)
initializes x; see x.__class__.__doc__ for signature
 
stream(self, response)
 
response(self, response)
 
read(self, sock, data)
Read Event Handler
 
simple(self, sock, code, message='')
Simple Response Events Handler
 
httperror(self, request, response, status, message=None, error=None)
Default HTTP Error Handler

Inherited from core.BaseComponent: __repr__, register, unregister

Inherited from core.Manager: __add__, __iadd__, __isub__, __len__, __sub__, flush, join, push, run, send, start, stop

Inherited from object: __delattr__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __str__

Static Methods

Inherited from core.Component: __new__

Class Variables
  channel = 'http'
The Component's Channel
Instance Variables

Inherited from core.Manager: manager

Properties

Inherited from core.Manager: name, running, state

Inherited from object: __class__

Method Details

__init__(self, *args, **kwargs)
(Constructor)

 

initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

read(self, sock, data)

 

Read Event Handler

Process any incoming data appending it to an internal buffer. Split the buffer by the standard HTTP delimiter CRLF and create Raw Event per line. Any unfinished lines of text, leave in the buffer.

Decorators:
  • @handler("read", target= "server")

simple(self, sock, code, message='')

 

Simple Response Events Handler

Send a simple response.

httperror(self, request, response, status, message=None, error=None)

 

Default HTTP Error Handler

Default Error Handler that by default just responds with the response in the error object passed. The response is normally modified by a HTTPError instance or a subclass thereof.