From 910f8f754d2da591f45cf3e28253d43cc13ddc16 Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Mon, 7 Nov 2022 16:48:03 +0100
Subject: [PATCH] WIP: http proxy: use iter_content instead of raw byte stream

---
 src/caosdb/connection/connection.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/caosdb/connection/connection.py b/src/caosdb/connection/connection.py
index fa14b693..bde67069 100644
--- a/src/caosdb/connection/connection.py
+++ b/src/caosdb/connection/connection.py
@@ -75,7 +75,12 @@ class _WrappedHTTPResponse(CaosDBHTTPResponse):
         return self.response.status_code
 
     def read(self, size=None):
-        return self.response.raw.read(size)
+        if size=None or size = 0:
+            result = b''
+            for chunk in self.response.iter_content(chunk_size=1024):
+                result = result + chunk
+            return result
+        return self.response.iter_content(size)
 
     def getheader(self, name, default=None):
         return self.response.headers[name] if name in self.response.headers else default
-- 
GitLab