def data_received(self, data): request = self.request # request.parser my change (100-continue) # Always invoke it via request try: len_data = len(data) parsed = request.parser.execute(data, len_data) if request.parser.is_headers_complete(): status_code = request.parser.get_status_code() if (request.headers.has('expect', '100-continue') and status_code == 100): request.new_parser() self.write_body() else: self._status_code = status_code if not self.event('on_headers').fired(): self.fire_event('on_headers') if (not self.event('post_request').fired() and self.is_message_complete()): parsed = len_data self.finished() if parsed != len_data: raise pulsar.ProtocolError('%s\n%s' % (self, self.headers)) except Exception as exc: self.finished(exc=exc)
def data_received(self, data): request = self._request # request.parser my change (100-continue) # Always invoke it via request if request.parser.execute(data, len(data)) == len(data): if request.parser.is_headers_complete(): self._status_code = request.parser.get_status_code() if not self.event('on_headers').done(): self.fire_event('on_headers') if (not self.has_finished and request.parser.is_message_complete()): self.finished() else: raise pulsar.ProtocolError('%s\n%s' % (self, self.headers))