def sendall(self, data, *args, **kw):
            self._sent_data.append(data)
            self.fd = FakeSockFile()
            self.fd.socket = self
            try:
                requestline, _ = data.split(b'\r\n', 1)
                method, path, version = parse_requestline(
                    decode_utf8(requestline))
                is_parsing_headers = True
            except __HOLE__:
                path = ''
                is_parsing_headers = False

                if self._entry is None:
                    # If the previous request wasn't mocked, don't
                    # mock the subsequent sending of data
                    return self.real_sendall(data, *args, **kw)
                else:
                    method = self._entry.method
                    path = self._entry.info.path

            self.fd.seek(0)

            if not is_parsing_headers:
                if len(self._sent_data) > 1:
                    headers = utf8(last_requestline(self._sent_data))
                    meta = self._entry.request.headers
                    body = utf8(self._sent_data[-1])
                    if meta.get('transfer-encoding', '') == 'chunked':
                        if (
                                not body.isdigit()
                                and (body != b'\r\n')
                                and (body != b'0\r\n\r\n')
                        ):
                            self._entry.request.body += body
                    else:
                        self._entry.request.body += body

                    httpretty.historify_request(headers, body, False)
                    return

            # path might come with
            s = urlsplit(path)
            POTENTIAL_HTTP_PORTS.add(int(s.port or 80))
            parts = list(map(utf8, data.split(b'\r\n\r\n', 1)))
            if len(parts) == 2:
                headers, body = parts
            else:
                headers = ''
                body = data

            request = httpretty.historify_request(headers, body)

            info = URIInfo(
                hostname=self._host,
                port=self._port,
                path=s.path,
                query=s.query,
                last_request=request
            )

            matcher, entries = httpretty.match_uriinfo(info)

            if not entries:
                self._entry = None
                self.real_sendall(data)
                return

            self._entry = matcher.get_next_entry(method, info, request)
dataset/ETHPy150Open gabrielfalcao/HTTPretty/httpretty/core.py/fakesock.socket.sendall