| OLD | NEW |
| 1 | 1 |
| 2 :mod:`asynchat` --- Asynchronous socket command/response handler | 2 :mod:`asynchat` --- Asynchronous socket command/response handler |
| 3 ================================================================ | 3 ================================================================ |
| 4 | 4 |
| 5 .. module:: asynchat | 5 .. module:: asynchat |
| 6 :synopsis: Support for asynchronous command/response protocols. | 6 :synopsis: Support for asynchronous command/response protocols. |
| 7 .. moduleauthor:: Sam Rushing <rushing@nightmare.com> | 7 .. moduleauthor:: Sam Rushing <rushing@nightmare.com> |
| 8 .. sectionauthor:: Steve Holden <sholden@holdenweb.com> | 8 .. sectionauthor:: Steve Holden <sholden@holdenweb.com> |
| 9 | 9 |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 Pushes a ``None`` on to the producer fifo. When this producer is popped off | 73 Pushes a ``None`` on to the producer fifo. When this producer is popped off |
| 74 the fifo it causes the channel to be closed. | 74 the fifo it causes the channel to be closed. |
| 75 | 75 |
| 76 | 76 |
| 77 .. method:: async_chat.collect_incoming_data(data) | 77 .. method:: async_chat.collect_incoming_data(data) |
| 78 | 78 |
| 79 Called with *data* holding an arbitrary amount of received data. The | 79 Called with *data* holding an arbitrary amount of received data. The |
| 80 default method, which must be overridden, raises a | 80 default method, which must be overridden, raises a |
| 81 :exc:`NotImplementedError` exception. | 81 :exc:`NotImplementedError` exception. |
| 82 |
| 83 |
| 84 .. method:: async_chat._collect_incoming_data(data) |
| 85 |
| 86 Sample implementation of a data collection rutine to be used in conjunction |
| 87 with :meth:`_get_data` in a user-specified :meth:`found_terminator`. |
| 82 | 88 |
| 83 | 89 |
| 84 .. method:: async_chat.discard_buffers() | 90 .. method:: async_chat.discard_buffers() |
| 85 | 91 |
| 86 In emergencies this method will discard any data held in the input and/or | 92 In emergencies this method will discard any data held in the input and/or |
| 87 output buffers and the producer fifo. | 93 output buffers and the producer fifo. |
| 88 | 94 |
| 89 | 95 |
| 90 .. method:: async_chat.found_terminator() | 96 .. method:: async_chat.found_terminator() |
| 91 | 97 |
| 92 Called when the incoming data stream matches the termination condition set | 98 Called when the incoming data stream matches the termination condition set |
| 93 by :meth:`set_terminator`. The default method, which must be overridden, | 99 by :meth:`set_terminator`. The default method, which must be overridden, |
| 94 raises a :exc:`NotImplementedError` exception. The buffered input data | 100 raises a :exc:`NotImplementedError` exception. The buffered input data |
| 95 should be available via an instance attribute. | 101 should be available via an instance attribute. |
| 102 |
| 103 |
| 104 .. method:: async_chat._get_data() |
| 105 |
| 106 Will return and clear the data received with the sample |
| 107 :meth:`_collect_incoming_data` implementation. |
| 96 | 108 |
| 97 | 109 |
| 98 .. method:: async_chat.get_terminator() | 110 .. method:: async_chat.get_terminator() |
| 99 | 111 |
| 100 Returns the current terminator for the channel. | 112 Returns the current terminator for the channel. |
| 101 | 113 |
| 102 | 114 |
| 103 .. method:: async_chat.handle_close() | 115 .. method:: async_chat.handle_close() |
| 104 | 116 |
| 105 Called when the channel is closed. The default method silently closes the | 117 Called when the channel is closed. The default method silently closes the |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 else: | 305 else: |
| 294 self.handling = True | 306 self.handling = True |
| 295 self.set_terminator(None) | 307 self.set_terminator(None) |
| 296 self.handle_request() | 308 self.handle_request() |
| 297 elif not self.handling: | 309 elif not self.handling: |
| 298 self.set_terminator(None) # browsers sometimes over-send | 310 self.set_terminator(None) # browsers sometimes over-send |
| 299 self.cgi_data = parse(self.headers, "".join(self.ibuffer)) | 311 self.cgi_data = parse(self.headers, "".join(self.ibuffer)) |
| 300 self.handling = True | 312 self.handling = True |
| 301 self.ibuffer = [] | 313 self.ibuffer = [] |
| 302 self.handle_request() | 314 self.handle_request() |
| OLD | NEW |