From 28924023bbba7e31474d0012a0526e09c4d9820d Mon Sep 17 00:00:00 2001 From: masariello Date: Fri, 8 Mar 2024 13:34:11 +0000 Subject: [PATCH] Fixes #1541: HTTPFilesystem has a race condition on data size between the open and read class, if content changes at server between the 2 class --- fsspec/implementations/http.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fsspec/implementations/http.py b/fsspec/implementations/http.py index 204a0a7ee..259aefb7b 100644 --- a/fsspec/implementations/http.py +++ b/fsspec/implementations/http.py @@ -332,7 +332,6 @@ def _open( autocommit=None, # XXX: This differs from the base class. cache_type=None, cache_options=None, - size=None, **kwargs, ): """Make a file-like object @@ -355,16 +354,14 @@ def _open( kw = self.kwargs.copy() kw["asynchronous"] = self.asynchronous kw.update(kwargs) - size = size or self.info(path, **kwargs)["size"] session = sync(self.loop, self.set_session) - if block_size and size: + if block_size: return HTTPFile( self, path, session=session, block_size=block_size, mode=mode, - size=size, cache_type=cache_type or self.cache_type, cache_options=cache_options or self.cache_options, loop=self.loop, @@ -549,7 +546,6 @@ def __init__( mode="rb", cache_type="bytes", cache_options=None, - size=None, loop=None, asynchronous=False, **kwargs, @@ -559,7 +555,7 @@ def __init__( self.asynchronous = asynchronous self.url = url self.session = session - self.details = {"name": url, "size": size, "type": "file"} + self.details = {"name": url, "size": None, "type": "file"} super().__init__( fs=fs, path=url,