Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin.support.flup.server.ajp_base Namespace Reference

Classes

class  ProtocolError
class  Packet
class  InputStream
class  Request
class  Connection
class  BaseAJPServer

Functions

def decodeString
def decodeRequestHeader
def decodeAttribute
def encodeString
def encodeResponseHeader

Variables

string __author__ = 'Allan Saddi <allan@saddi.com>'
string __version__ = '$Revision$'
list __all__ = ['BaseAJPServer']
string SERVER_PREFIX = '\x12\x34'
string CONTAINER_PREFIX = 'AB'
string PKTTYPE_FWD_REQ = '\x02'
string PKTTYPE_SHUTDOWN = '\x07'
string PKTTYPE_PING = '\x08'
string PKTTYPE_CPING = '\x0a'
string PKTTYPE_SEND_BODY = '\x03'
string PKTTYPE_SEND_HEADERS = '\x04'
string PKTTYPE_END_RESPONSE = '\x05'
string PKTTYPE_GET_BODY = '\x06'
string PKTTYPE_CPONG = '\x09'
list methodTable
list requestHeaderTable
list attributeTable
list responseHeaderTable
string LoggerName = 'ajp-wsgi'
tuple console = logging.StreamHandler()

Class Documentation

class MoinMoin::support::flup::server::ajp_base::ProtocolError
Exception raised when the server does something unexpected or
sends garbled data. Usually leads to a Connection closing.

Definition at line 156 of file ajp_base.py.


Function Documentation

Decode a request attribute.

Definition at line 192 of file ajp_base.py.

00192 
00193 def decodeAttribute(data, pos=0):
00194     """Decode a request attribute."""
00195     try:
00196         i = ord(data[pos])
00197         pos += 1
00198         if i == 0xff:
00199             # end
00200             return None, None, pos
00201         elif i == 0x0a:
00202             # name follows
00203             name, pos = decodeString(data, pos)
00204         elif i == 0x0b:
00205             # Special handling of SSL_KEY_SIZE.
00206             name = attributeTable[i]
00207             # Value is an int, not a string.
00208             value = struct.unpack('>H', data[pos:pos+2])[0]
00209             return name, str(value), pos+2
00210         else:
00211             name = attributeTable[i]
00212             if name is None:
00213                 raise ValueError, 'bad attribute code'
00214         value, pos = decodeString(data, pos)
00215         return name, value, pos
00216     except Exception, e:
00217         raise ProtocolError, 'decodeAttribute: '+str(e)

Here is the call graph for this function:

Here is the caller graph for this function:

Decode a request header/value pair.

Definition at line 175 of file ajp_base.py.

00175 
00176 def decodeRequestHeader(data, pos=0):
00177     """Decode a request header/value pair."""
00178     try:
00179         if data[pos] == '\xa0':
00180             # Use table
00181             i = ord(data[pos+1])
00182             name = requestHeaderTable[i]
00183             if name is None:
00184                 raise ValueError, 'bad request header code'
00185             pos += 2
00186         else:
00187             name, pos = decodeString(data, pos)
00188         value, pos = decodeString(data, pos)
00189         return name, value, pos
00190     except Exception, e:
00191         raise ProtocolError, 'decodeRequestHeader: '+str(e)

Here is the call graph for this function:

Here is the caller graph for this function:

Decode a string.

Definition at line 163 of file ajp_base.py.

00163 
00164 def decodeString(data, pos=0):
00165     """Decode a string."""
00166     try:
00167         length = struct.unpack('>H', data[pos:pos+2])[0]
00168         pos += 2
00169         if length == 0xffff: # This was undocumented!
00170             return '', pos
00171         s = data[pos:pos+length]
00172         return s, pos+length+1 # Don't forget NUL
00173     except Exception, e:
00174         raise ProtocolError, 'decodeString: '+str(e)

Here is the caller graph for this function:

Encode a response header/value pair.

Definition at line 222 of file ajp_base.py.

00222 
00223 def encodeResponseHeader(name, value):
00224     """Encode a response header/value pair."""
00225     lname = name.lower()
00226     if lname in responseHeaderTable:
00227         # Use table
00228         i = responseHeaderTable.index(lname)
00229         out = '\xa0' + chr(i)
00230     else:
00231         out = encodeString(name)
00232     out += encodeString(value)
00233     return out

Here is the call graph for this function:

Here is the caller graph for this function:

Encode a string.

Definition at line 218 of file ajp_base.py.

00218 
00219 def encodeString(s):
00220     """Encode a string."""
00221     return struct.pack('>H', len(s)) + s + '\x00'

Here is the caller graph for this function:


Variable Documentation

Definition at line 46 of file ajp_base.py.

string MoinMoin.support.flup.server.ajp_base.__author__ = 'Allan Saddi <allan@saddi.com>'

Definition at line 27 of file ajp_base.py.

Definition at line 28 of file ajp_base.py.

Initial value:
00001 [
00002     None,
00003     'CONTEXT',
00004     'SERVLET_PATH',
00005     'REMOTE_USER',
00006     'AUTH_TYPE',
00007     'QUERY_STRING',
00008     'JVM_ROUTE',
00009     'SSL_CERT',
00010     'SSL_CIPHER',
00011     'SSL_SESSION',
00012     None, # name follows
00013     'SSL_KEY_SIZE'
00014     ]

Definition at line 115 of file ajp_base.py.

tuple MoinMoin.support.flup.server.ajp_base.console = logging.StreamHandler()

Definition at line 149 of file ajp_base.py.

Definition at line 50 of file ajp_base.py.

Definition at line 146 of file ajp_base.py.

Initial value:
00001 [
00002     None,
00003     'OPTIONS',
00004     'GET',
00005     'HEAD',
00006     'POST',
00007     'PUT',
00008     'DELETE',
00009     'TRACE',
00010     'PROPFIND',
00011     'PROPPATCH',
00012     'MKCOL',
00013     'COPY',
00014     'MOVE',
00015     'LOCK',
00016     'UNLOCK',
00017     'ACL',
00018     'REPORT',
00019     'VERSION-CONTROL',
00020     'CHECKIN',
00021     'CHECKOUT',
00022     'UNCHECKOUT',
00023     'SEARCH',
00024     'MKWORKSPACE',
00025     'UPDATE',
00026     'LABEL',
00027     'MERGE',
00028     'BASELINE_CONTROL',
00029     'MKACTIVITY'
00030     ]

Definition at line 66 of file ajp_base.py.

Definition at line 56 of file ajp_base.py.

Definition at line 63 of file ajp_base.py.

Definition at line 61 of file ajp_base.py.

Definition at line 53 of file ajp_base.py.

Definition at line 62 of file ajp_base.py.

Definition at line 55 of file ajp_base.py.

Definition at line 59 of file ajp_base.py.

Definition at line 60 of file ajp_base.py.

Definition at line 54 of file ajp_base.py.

Initial value:
00001 [
00002     None,
00003     'Accept',
00004     'Accept-Charset',
00005     'Accept-Encoding',
00006     'Accept-Language',
00007     'Authorization',
00008     'Connection',
00009     'Content-Type',
00010     'Content-Length',
00011     'Cookie',
00012     'Cookie2',
00013     'Host',
00014     'Pragma',
00015     'Referer',
00016     'User-Agent'
00017     ]

Definition at line 97 of file ajp_base.py.

Initial value:
00001 [
00002     None,
00003     'content-type',
00004     'content-language',
00005     'content-length',
00006     'date',
00007     'last-modified',
00008     'location',
00009     'set-cookie',
00010     'set-cookie2',
00011     'servlet-engine',
00012     'status',
00013     'www-authenticate'
00014     ]

Definition at line 130 of file ajp_base.py.

Definition at line 49 of file ajp_base.py.