Start response processing.
(self, connection, read_until_eof=False)
| 597 | |
| 598 | @asyncio.coroutine |
| 599 | def start(self, connection, read_until_eof=False): |
| 600 | """Start response processing.""" |
| 601 | self._setup_connection(connection) |
| 602 | |
| 603 | while True: |
| 604 | httpstream = self._reader.set_parser(self._response_parser) |
| 605 | |
| 606 | # read response |
| 607 | message = yield from httpstream.read() |
| 608 | if message.code != 100: |
| 609 | break |
| 610 | |
| 611 | if self._continue is not None and not self._continue.done(): |
| 612 | self._continue.set_result(True) |
| 613 | self._continue = None |
| 614 | |
| 615 | # response status |
| 616 | self.version = message.version |
| 617 | self.status = message.code |
| 618 | self.reason = message.reason |
| 619 | self._should_close = message.should_close |
| 620 | |
| 621 | # headers |
| 622 | self.headers = CIMultiDictProxy(message.headers) |
| 623 | self.raw_headers = tuple(message.raw_headers) |
| 624 | |
| 625 | # payload |
| 626 | response_with_body = self._need_parse_response_body() |
| 627 | self._reader.set_parser( |
| 628 | aiohttp.HttpPayloadParser(message, |
| 629 | readall=read_until_eof, |
| 630 | response_with_body=response_with_body), |
| 631 | self.content) |
| 632 | |
| 633 | # cookies |
| 634 | self.cookies = http.cookies.SimpleCookie() |
| 635 | if hdrs.SET_COOKIE in self.headers: |
| 636 | for hdr in self.headers.getall(hdrs.SET_COOKIE): |
| 637 | try: |
| 638 | self.cookies.load(hdr) |
| 639 | except http.cookies.CookieError as exc: |
| 640 | client_logger.warning( |
| 641 | 'Can not load response cookies: %s', exc) |
| 642 | return self |
| 643 | |
| 644 | def close(self, force=True): |
| 645 | if not force: |
nothing calls this directly
no test coverage detected