Script transports_nb_py_orig :: Class NonBlockingHTTP
[hide private]
[frames] | no frames]

Class NonBlockingHTTP


Socket wrapper that creates HTTP message out of sent data and peels-off HTTP headers from incoming messages
Instance Methods [hide private]
 
__init__(self, raise_event, on_disconnect, idlequeue, estabilish_tls, certs, on_http_request_possible, on_persistent_fallback, http_dict, proxy_dict=None)
Each trasport class can have different constructor but it has to have at least all the arguments of NonBlockingTransport constructor
 
http_send(self, raw_data, now=False)
 
_on_receive(self, data)
Preceeds passing received data to owner class. Gets rid of HTTP headers and checks them.
 
build_http_message(self, httpbody, method='POST')
Builds http message with given body. Values for headers and status line fields are taken from class variables
 
parse_http_message(self, message)
(statusline - list of e.g. ['HTTP/1.1', '200', 'OK'],

Inherited from NonBlockingTCP: connect, disconnect, encode_stanza, pollend, pollin, pollout, read_timeout, remove_timeout, send, set_timeout, start_disconnect, tls_init

Inherited from NonBlockingTransport: get_fd, get_state, onreceive, plugin, plugout, read_timeout2, renew_send_timeout, renew_send_timeout2, set_send_timeout, set_send_timeout2, set_state, set_timeout2

Inherited from nbxmpp.plugin.PlugIn: PlugIn, PlugOut

Class Methods [hide private]

Inherited from nbxmpp.plugin.PlugIn: get_instance

Instance Variables [hide private]

Inherited from nbxmpp.idlequeue.IdleObject: fd

Method Details [hide private]

__init__(self, raise_event, on_disconnect, idlequeue, estabilish_tls, certs, on_http_request_possible, on_persistent_fallback, http_dict, proxy_dict=None)
(Constructor)

 
Each trasport class can have different constructor but it has to have at least all the arguments of NonBlockingTransport constructor
Parameters:
  • on_http_request_possible - method to call when HTTP request to socket owned by transport is possible.
  • on_persistent_fallback - callback called when server ends TCP connection. It doesn't have to be fatal for HTTP session.
  • http_dict - dictionary with data for HTTP request and headers
Overrides: nbxmpp.idlequeue.IdleObject.__init__

http_send(self, raw_data, now=False)

 

_on_receive(self, data)

 
Preceeds passing received data to owner class. Gets rid of HTTP headers and checks them.
Overrides: NonBlockingTCP._on_receive

build_http_message(self, httpbody, method='POST')

 
Builds http message with given body. Values for headers and status line fields are taken from class variables

parse_http_message(self, message)

 
Split http message into a tuple:
  • (statusline - list of e.g. ['HTTP/1.1', '200', 'OK'],

  • headers - dictionary of headers e.g. {'Content-Length': '604',

    'Content-Type': 'text/xml; charset=utf-8'},

  • httpbody - string with http body)

  • http_rest - what is left in the message after a full HTTP header + body