Previous|Next|Index
Asynchronous Protocol API's
Every protocol implmentation needs to define a class implementing the
following interfaces:
- __init__(url, method, parameters) -> instance
- url: scheme identifier stripped
- method: normally 'GET' (for http also 'POST')
- parameters: additional headers for http
- may raise exception
- pollmeta() -> (message, readyflag)
- getmeta() -> (errcode, errmessage, dictionary)
- polldata() -> (message, readyflag)
- getdata(maxbytes) -> data or empty string
- fileno() -> file descriptor for Unix select()
- close()
All errors are to be translated into HTTP error codes (the richest set
of the currently understood protocols).
Pseudo-protocols like "mailto:" that don't return data can return an
error code 204 ("request accepted, no return document").
Protocols like "hdl:" that map into other protocols can return an
error code 301 ("document moved"); the request is then transparently
retried by the higher layer