From 9560795d79f367f8b3d18b086891a693bdcd88bc Mon Sep 17 00:00:00 2001 From: Vincent Castaneda Date: Wed, 20 Mar 2024 18:31:06 +0900 Subject: [PATCH] remove HEAD -> GET workaround --- opensearchpy/_async/http_aiohttp.py | 8 ++------ opensearchpy/connection/http_async.py | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/opensearchpy/_async/http_aiohttp.py b/opensearchpy/_async/http_aiohttp.py index c49fd574..b3f5c49d 100644 --- a/opensearchpy/_async/http_aiohttp.py +++ b/opensearchpy/_async/http_aiohttp.py @@ -246,12 +246,8 @@ async def perform_request( else: query_string = "" - # There is a bug in aiohttp that disables the re-use - # of the connection in the pool when method=HEAD. - # See: aio-libs/aiohttp#1769 is_head = False if method == "HEAD": - method = "GET" is_head = True # Top-tier tip-toeing happening here. Basically @@ -301,9 +297,9 @@ async def perform_request( timeout=timeout, fingerprint=self.ssl_assert_fingerprint, ) as response: - if is_head: # We actually called 'GET' so throw away the data. + if is_head: await response.release() - raw_data = "" + raw_data = "" # HEAD method has no response body else: raw_data = await response.text() duration = self.loop.time() - start diff --git a/opensearchpy/connection/http_async.py b/opensearchpy/connection/http_async.py index f5a4ec7c..49d91872 100644 --- a/opensearchpy/connection/http_async.py +++ b/opensearchpy/connection/http_async.py @@ -167,12 +167,8 @@ async def perform_request( else: query_string = "" - # There is a bug in aiohttp that disables the re-use - # of the connection in the pool when method=HEAD. - # See: https://github.com/aio-libs/aiohttp/issues/1769 is_head = False if method == "HEAD": - method = "GET" is_head = True # Top-tier tip-toeing happening here. Basically @@ -221,9 +217,9 @@ async def perform_request( timeout=timeout, fingerprint=self.ssl_assert_fingerprint, ) as response: - if is_head: # We actually called 'GET' so throw away the data. + if is_head: await response.release() - raw_data = "" + raw_data = "" # HEAD method has no response body else: raw_data = await response.text() duration = self.loop.time() - start