Package Halberd :: Module clientlib :: Class HTTPClient

[show private | hide private]
[frames | no frames]

## Class HTTPClient

Known Subclasses:
  `HTTPSClient`

Special-purpose HTTP client.

Method Summary
| ``__init__`(self)` Initializes the object.
| `__del__(self)`
`tuple` | ``getHeaders`(self, address, urlstr)` Talk to the target webserver and fetch MIME headers.

Instance Variable Summary
`int` | `bufsize`: Buffer size for network I/O.
`str` | `template`: Template of the HTTP request to be sent to the target.
`float` | `timeout`: Timeout for socket operations (expressed in seconds).

Method Details

### __init__(self)
(Constructor)

Initializes the object.

### getHeaders(self, address, urlstr)

Talk to the target webserver and fetch MIME headers.

  Parameters:
    `address` - The target's network address.
    (type=`tuple`)
    `urlstr` - URL to use.
    (type=`str`)
  Returns:
    The time when the client started reading the server's response and the MIME headers that were sent.
    (type=`tuple`)

Instance Variable Details

### bufsize

Buffer size for network I/O.

  Type:
    `int`
  Value:

        1024

### template

Template of the HTTP request to be sent to the target.

  Type:
    `str`
  Value:

        '''GET %(request)s HTTP/1.1\r
        Host: %(hostname)s%(port)s\r
        Pragma: no-cache\r
        Cache-control: no-cache\r
        User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20\
        050414 Firefox/1.0.3\r
        Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicati\
        on/x-shockwave-flash, */*\r
        ...

### timeout

Timeout for socket operations (expressed in seconds). WARNING: changing this value is strongly discouraged.

  Type:
    `float`
  Value:

        2

Generated by Epydoc 2.1 on Thu Aug 24 19:08:31 2006 | http://epydoc.sf.net