# No calling the handleResponse callback here because this is really bad. The not-so-bad exceptions (e.g. an error during reading the response) will be caught further down.
@@ -105,7 +116,63 @@ class ClientResponse(aiohttp.client_reqrep.ClientResponse):
def iter_all(self):
return itertools.chain(self.history, (self,))
async def _read(self):
#FIXME: This uses internal undocumented APIs of aiohttp
payload = Payload()
self._rawData.responseData.seek(0)
beginning = self._rawData.responseData.read(32768) # Headers must fit into 32 KiB. That's more than most clients out there, but aiohttp does *not* have this restriction!
@@ -243,3 +243,19 @@ class SpecDependencies(typing.NamedTuple):
packages: tuple = ()
files: tuple = ()
extra: typing.Any = None
class ReadonlyFileView:
'''
A poor read-only view for a file object. It hides the writing methods and passes everything else through to the underlying file object. Note that this does *not* actually prevent modification at all.